I can see my player respond to collision in real time, instead of it being instant
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
I can see my player respond to collision in real time, instead of it being instant
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)
- Attachments
-
- game.love
- (21.44 KiB) Downloaded 172 times
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: I can see my player respond to collision in real time, instead of it being instant
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 7 guests