How do I keep the player from moving temporarily?

Started by Glenjamin, Fri 20/02/2015 20:15:13

Previous topic - Next topic

Glenjamin

There's a part in my game where the character breaks his leg and needs an item to fix it. How can I make it so the player cannot move while it's leg is broken?

Gurok

You could turn off the walkable area under the player:

Code: ags
RemoveWalkableArea(GetWalkableAreaAt(player.x - GetViewportX(), player.y - GetViewportY()));


And when he's ready to walk again, turn it back on (provided he's still in the same position):

Code: ags
RestoreWalkableArea(GetWalkableAreaAt(player.x - GetViewportX(), player.y - GetViewportY()));


If you have other characters that need to move around, you might want to make a special walkable area for the location where the character breaks his leg and turn that on/off. There are probably other ways to achieve this. This is just the most direct way I can think of.
[img]http://7d4iqnx.gif;rWRLUuw.gi

SMF spam blocked by CleanTalk