hi guys and girls.
i'm making a game where a ball bounces off some platforms and walls. these surfaces are made using a tile map. there are tiles for the four corners and each of the sides, so i can make boxes of any size or shape.
the ball is affected by gravity and im trying to make it bounce off the surfaces on collision. the problem is that the surfaces are only 10 pixels thick and the ball can travel up to 15 pixels in every game "tick". this means that sometimes the ball passes straight through the surface instead of colliding.
also, this means that sometimes the ball gets stuck in the surfaces. for example, if the ball bounces onto the floor and the collision is detected in the middle of the floor instead of the edge (because of the glitch), the line of code
yspeed = (0 - yspeed)
reverses the direction of travel, but because gravity is affecting the ball, it gets stuck.
is there a better way to approach all this?
el neil
i'm making a game where a ball bounces off some platforms and walls. these surfaces are made using a tile map. there are tiles for the four corners and each of the sides, so i can make boxes of any size or shape.
the ball is affected by gravity and im trying to make it bounce off the surfaces on collision. the problem is that the surfaces are only 10 pixels thick and the ball can travel up to 15 pixels in every game "tick". this means that sometimes the ball passes straight through the surface instead of colliding.
also, this means that sometimes the ball gets stuck in the surfaces. for example, if the ball bounces onto the floor and the collision is detected in the middle of the floor instead of the edge (because of the glitch), the line of code
yspeed = (0 - yspeed)
reverses the direction of travel, but because gravity is affecting the ball, it gets stuck.
is there a better way to approach all this?
el neil