How do I create basic gravity via javascript?

Hello guys,

I’m totally new to scripting and I’m having a problem with a javascript that I’m wanting to put in a University project.

The basic idea for the game was for it to be a 2D platformer with a gravity function.

Black blocks attract the player so they can walk upside down and so on.

White blocks repel the player so that they float upwards slightly.

I have the code to change colours now I just need to tackle this gravity issue.

Thanks guys!

you don’t need javascript if you have a rigidbody and meshcollider :slight_smile:
If you want space gravity. Then IDK (I’m just getting started with unity)