Skip to main content
edited body
Source Link
ssb
  • 1.3k
  • 2
  • 12
  • 27

It looks like you're constantly moving the platforms to the left, as you explain, but you're only checking for collisions along the XY axis. So what happens if you fall down a pit? The platforms will continue moving to the left, the collision will register from the right side of your player, and the position will be adjusted back up to the surface of the platform. You need to implement another check that stops the player from moving horizontally in the platforms and resolving back up to the top.

If your world is moving around your character then your character's x velocity will be 0 relative to our view, but when the player collides with a platform either the world has to stop moving or the player has to move back to avoid progressing through the platforms. If the world is moving around you then you might just want to make an instant game over condition if you're colliding with the side of an obstacle rather than landing on it, or just stop the movement and let the player fall.

It looks like you're constantly moving the platforms to the left, as you explain, but you're only checking for collisions along the X axis. So what happens if you fall down a pit? The platforms will continue moving to the left, the collision will register from the right side of your player, and the position will be adjusted back up to the surface of the platform. You need to implement another check that stops the player from moving horizontally in the platforms and resolving back up to the top.

If your world is moving around your character then your character's x velocity will be 0 relative to our view, but when the player collides with a platform either the world has to stop moving or the player has to move back to avoid progressing through the platforms. If the world is moving around you then you might just want to make an instant game over condition if you're colliding with the side of an obstacle rather than landing on it, or just stop the movement and let the player fall.

It looks like you're constantly moving the platforms to the left, as you explain, but you're only checking for collisions along the Y axis. So what happens if you fall down a pit? The platforms will continue moving to the left, the collision will register from the right side of your player, and the position will be adjusted back up to the surface of the platform. You need to implement another check that stops the player from moving horizontally in the platforms and resolving back up to the top.

If your world is moving around your character then your character's x velocity will be 0 relative to our view, but when the player collides with a platform either the world has to stop moving or the player has to move back to avoid progressing through the platforms. If the world is moving around you then you might just want to make an instant game over condition if you're colliding with the side of an obstacle rather than landing on it, or just stop the movement and let the player fall.

Source Link
ssb
  • 1.3k
  • 2
  • 12
  • 27

It looks like you're constantly moving the platforms to the left, as you explain, but you're only checking for collisions along the X axis. So what happens if you fall down a pit? The platforms will continue moving to the left, the collision will register from the right side of your player, and the position will be adjusted back up to the surface of the platform. You need to implement another check that stops the player from moving horizontally in the platforms and resolving back up to the top.

If your world is moving around your character then your character's x velocity will be 0 relative to our view, but when the player collides with a platform either the world has to stop moving or the player has to move back to avoid progressing through the platforms. If the world is moving around you then you might just want to make an instant game over condition if you're colliding with the side of an obstacle rather than landing on it, or just stop the movement and let the player fall.