I'm working on a game and I'd like to be able to crush the player 🙂
For example, the ceiling for a level may gradually move down, closer and closer to the floor. If the player is in the middle of this ceiling on floor action when the ceiling gets to close to the floor for the player's body to fit I want the player to die. Something like this:
1. Player is okay
=========================
😀
=========================
2. Player is about to be crushed
=========================
😮
=========================
3. Crushed!
=========================
=========================
I'm wondering how would you go about this? Touching the floor or the ceiling it okay (there is nothing inherent about touching either body that should harm the player). One thought I've had is that touching the floor AND the ceiling at the same time would be one of the properties of a "crushed" state, but it's possible that you could erroneously achieve this state if you're narrowly escaping being crushed. Also I'd like this crushing system to be flexible, that is, if the player gets trapped between any two bodies he's be crushed.
For example, the ceiling for a level may gradually move down, closer and closer to the floor. If the player is in the middle of this ceiling on floor action when the ceiling gets to close to the floor for the player's body to fit I want the player to die. Something like this:
1. Player is okay
=========================
😀
=========================
2. Player is about to be crushed
=========================
😮
=========================
3. Crushed!
=========================
=========================
I'm wondering how would you go about this? Touching the floor or the ceiling it okay (there is nothing inherent about touching either body that should harm the player). One thought I've had is that touching the floor AND the ceiling at the same time would be one of the properties of a "crushed" state, but it's possible that you could erroneously achieve this state if you're narrowly escaping being crushed. Also I'd like this crushing system to be flexible, that is, if the player gets trapped between any two bodies he's be crushed.