Posted July 03, 2021 by pancelor
a few small updates:
if x then y end
to if(x)y
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:
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
my high score is 64 now, but I’m sure better is possible. hope you like it!