How to make an easy platformer (collision)

How to make an easy platformer

here you can learn to make a easy platformer with the ‘gravity’ variable.


1st example


1st
Make a ‘gravity’ variable

2nd
Make a rule in the player:
(game starts)
((set {gravity} to {-9}
((repeat forever
Change Y by {gravity}))

3rd
Make another rule in player:
(when is touching {any object})
((set {gravity} to {0}))

Every code has it downs. If you use this, when touching, player will stop. Try it your self. Pictures in comments.


2nd example


We will use the ‘vertical velocity’ variable.
1st
make a new rule in player:
(when game is playing)
((change Y by {vertical velocity}))
((increase {vertical velocity} by {-1}

2nd
make another rule in player:
(when is touching {any object})
((set {vertical velocity} to {1}))
((change y by {1}))

This codes’ down is when collides it will go up.

  • 1st example
  • 2nd example
  • i know more codes
  • i like all of them!

0 voters

Pictures in the replies!
Thanks for reading, this took a long time to write…the best code is @Spy_Guy_96’s collision code but those code that i wrote i figured them out my self. maybe some of you did too. Vote 3 if you know some of the codes here. And my tag list:

Tag list!

@creationsofavillager
@ashley.ballet
@Nobody
@FRENCH_WAVE123
@ExplodingDucks
@GweTV
@LittleNoobyBoi
@GOATGAMES
@DolphinGirl7
@anon56607322
@Temmy
@Heracc
@PumpkinGirl
@Halcio
@FearlessPhoenix
@ellatm
@noobcoder2000
@SilverStar

Thanks for reading!

14 Likes

Nice! Good topic

1 Like

Ah now i will post the pictures…and thanks

1 Like

Really good explained

2 Likes

Here photo for example 1! @TheCMStudios add this in op?


And add this too
Photo for example 2!

2 Likes

Would you increase gravity by -9 or set it to that

I dont need help just asking

@Albus ^^^^^^^^^^^^^

3 Likes

set cause…no reason

1 Like

what if you are changing it from the right or left tho?

1 Like

what do you mean

1 Like

Nevermind

nice topic

1 Like

i have a feeling i am going to have another ‘nice topic’ badge

Yeah they are easy to get when you know what you are talking about

Again, nice!

1 Like

Can u take me off your tag list? I don’t remember signing up

3 Likes

ok!

2 Likes

I know I say this a lot, but thanks for this, seriously I really needed this. I needed help with this for a platformer I’m currently working on. I’m going to bookmark this.

1 Like

Ok! Maybe i could help!

1 Like

You’re already on my BT list so you will most definitely be helping! Thanks for the suggestion.

1 Like

Cool!!! Let’s bookmark this :smiley::slightly_smiling_face:

2 Likes

Like it will still work in method 2 without the Change Y by (1) won’t it?

2 Likes