Jump to content

New problem with collision


Ragraphics
 Share

Recommended Posts

Hi there,

I am trying to create a simple platform game, where when my player (sprite) collide with a flame, player lose a live and it must restart in a start position X and Y.

Problem is , when player jump on flame, it lost a life, but physics.arcade let it fall again on flame , so I lost another life and so on until game gone in gameover.

How can I solve?

THX

Link to comment
Share on other sites

This is a pretty basic problem of dying/respawning in games, and honestly, there is an infinite number of ways to solve it. Here are some examples:

1. If you are making something like a Sonic or Mario platformer, you would probably have a death animation and then restart the player a ways away from the obstacle at some kind of check point or back at the start of the stage. Checkpoints and stage start points are specifically placed in safe areas to prevent quick re-deaths. 

2. If you want the player to restart near where they died, such as in most beat-em-up games, it is common to give them a couple of seconds of invincibility to get away from the thing that killed them. 

3. In the same situation as #2, some platformers respawn players where they died, but instead they programmatically move the player back some and spawn them at the nearest safe location that is before the obstacle that killed them. You usually want to be sure you are respawning them before the obstacle so they don't get a free clearing of it by dying. 

4. Some games combine #2 and #3 to respawn them before the obstacle while also giving them a few moments of invincibility. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...