My stage is stored as an array. To check collision against square blocks I just divide the current position of each side of the bounding box by the block size, and check that position on the array. If any of them is in a solid block, it sets the player's position to the correct place based on the player's movement. If the player is moving to the left when the collision occurs, he is placed on the right side of the block he's touching.
nice! u should help the beginners like me with a tutorial XD
vas3000 2 years ago
What kind of Collision detection do you use and how did you work out the neat response :)?
lRever 2 years ago
My stage is stored as an array. To check collision against square blocks I just divide the current position of each side of the bounding box by the block size, and check that position on the array. If any of them is in a solid block, it sets the player's position to the correct place based on the player's movement. If the player is moving to the left when the collision occurs, he is placed on the right side of the block he's touching.
I think.
What do you mean by "neat response", though?
kontegs 2 years ago
Thank you for your quick reply.
You already answerd the my question about the response. With response I ment the response from the player on collision.
lRever 2 years ago
Pretty neat. The idea of constructing the level around the character is great, although the physics must be quite daunting.
semprance 2 years ago