Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Gravity.
- -EmeraldThunder-
-
Scratcher
1000+ posts
Gravity.
I have create platformer and scrolling platformer engines in the past, however I am experimenting with making a tiled one. The player will not stop ‘bouncing’ on the ground no matter what I do.
I would like someone to have a look at this and try to fix it please.
https://turbowarp.org/554684341
I would like someone to have a look at this and try to fix it please.
https://turbowarp.org/554684341
- Thingied
-
Scratcher
1000+ posts
Gravity.
Three things.
1. If the x and y of the player is less or equal to the length of a tile plus the length of the player, that mean's it's colliding with it. You don't need to use the SCROLL X and Y variables just need to compare the distances.

2. Every single time the player moves and there's a statement that checks to see if it's touching a tile, you have to run the check because it might be out of it already.

3. Since you're changing gravity by -0.5 every single tick, you have to go up 0.5.

1. If the x and y of the player is less or equal to the length of a tile plus the length of the player, that mean's it's colliding with it. You don't need to use the SCROLL X and Y variables just need to compare the distances.

2. Every single time the player moves and there's a statement that checks to see if it's touching a tile, you have to run the check because it might be out of it already.

3. Since you're changing gravity by -0.5 every single tick, you have to go up 0.5.

- orangeicecream23
-
Scratcher
100+ posts
Gravity.
when green flag clicked
set [gravity v] to [0]
forever
repeat until <color [...] is touching [...] ?>
change y by ((0) - (gravity))
change [gravity v] by (1)
end
set [gravity v] to [0]
- -EmeraldThunder-
-
Scratcher
1000+ posts
Gravity.
1. If the x and y of the player is less or equal to the length of a tile plus the length of the player, that mean's it's colliding with it. You don't need to use the SCROLL X and Y variables just need to compare the distances.I will need that for later when I want to stop scrolling at the boundaries.
- Discussion Forums
- » Help with Scripts
-
» Gravity.


