collision fix, better scrolling


a few small updates:

changes

  • make the fall speed a bit slower to prevent clipping through platforms
  • let the player go much further down before forcing the screen to scroll. this should make the difficulty curve much nicer – now, you have a chance to survive when the screen starts scrolling more and more quickly
  • save some characters by changing an if x then y end to if(x)y

collision

the collision clipping thing is kinda interesting and maybe worth explaining how it works:

so, the code used to edit your fall-speed each frame with this line: v=v*.85+.52

this means “accelerate by .52 pixels per tick per tick (due to gravity) but also slow down 15% (due to air resistance)”

this feels nice, because you fall all gravity-like but also you end up with a max fallspeed. for instance, if you start perfectly still and go into freefall, your speed over many frames takes on these values:

chart showing fall speed over time

as you can see, your speed starts to change less and less, eventually settling down at 3.47. you can figure this out by running the simulation, but you can also figure it out with math: solve the equation x=x*.85+.52 for x. this means your terminal velocity is .52/(1-.85), which is 3.47. neat!

why is this helpful? well, the platforms are 2 pixels thick, so if you move 3.5 pixels in a single frame that means you might clip through them sometimes. so, I tweaked the values of wind_resistance and gravity until they both felt good, and also had a nicer terminal velocity (gravity/(1-wind_resistance)). the new formula I chose was v=v*.83+.45, which gives a terminal velocity of 2.65. this might still lead to clipping? but in my experience it’s way less frequent, and feels nice and snappy

that’s all

my high score is 64 now, but I’m sure better is possible. hope you like it!

Files

drop_html.zip Play in browser
Jul 03, 2021

Leave a comment

Log in with itch.io to leave a comment.