There is arena. Player has 8 Direction Movement. How I can restrict him to leave sand area? (I know, when Player leaves sund make speed =0, acceleration = 0, but how make him return his speed stats when he want go out from this "wall".
Develop games in your browser. Powerful, performant & highly capable.
You could do something like this:
Create 2 variables:
If PlayerSprite touches SandSprite Set PlayerLastX to Player.X and PlayerLastY to Player.Y
If PlayerSprite is not touching Sand Sprite:
Set Player position to PlayerLastX & PlayerLastY so that it remains on the SandSprite and can still move where it came from.