Page 1 of 1
I can see my player respond to collision in real time, instead of it being instant
Posted: Sun Jun 16, 2024 8:24 pm
by 101Corp
I can see my player respond to collision in real time, instead of it being instant. I don't want the player bouncing, I want the player to collide with the chunk and instantly move out to the top of it. I made a custom algorithm for detecting collision on images and it is what I use. How do I fix my issue? (game .love included in attachments)
Re: I can see my player respond to collision in real time, instead of it being instant
Posted: Thu Jul 04, 2024 10:46 am
by DaedalusYoung
I'm guessing it's because you run the loop 8 times. It will check if mainY is on a non-zero alpha channel and it will move the playerY up 1 pixel. That doesn't change mainY in that loop, so as it runs 8 times, mainY doesn't change, but playerY moves up 8 pixels. On the next frame, it will move playerY down 1 pixel once, because that's before the loop. So for 8 frames or so, it will move the player down 1 pixel each frame, then when it hits the floor, it will move the player up 8 pixels and that's how it bounces.