Restart Level on Speed 0?
I'd like to restart the level IF the player's speed becomes 0. Basically, if the player runs into an obstacle that prevents them from moving any further, I want them to start from the beginning of the level.
I know I can set it to restart when a certain speed is reached, but what if I want the restart level event to initiate when the speed becomes 0, from an already 1+ number while moving forward?
asked Mar 12 '15 at 04:29 PM in Blueprint Scripting
There are two ways to do this. If you really want any event in which the player stops moving and are using a character (not a pawn) then you can check for the characters velocity (which is part of the character movement component every character owns). You can get it via the same as well. This... well it represents your velocity. If that is below a certain number you can just say he isn't moving anymore and restart the level.
However sometimes you might want to just pause the movement for a bit which would trigger this as well. A great solution could be just detecting collisions (from the actor you hit) via an interface. On event hit -> if other actor implements interface -> kill. Like this you can chose yourself which obstacles actually kill your character.
I hope this helps.
answered Mar 12 '15 at 04:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here