|
|
@ -4,6 +4,7 @@ public class Player { |
|
|
|
public Vector2 position; |
|
|
|
public Vector2 direction; |
|
|
|
public GameManager gameManager; |
|
|
|
public Vector2 savedDirection; |
|
|
|
|
|
|
|
public Player(GameManager gameManager) { |
|
|
|
this.gameManager = gameManager; |
|
|
@ -23,6 +24,9 @@ public class Player { |
|
|
|
if(!newPosIsWall) { |
|
|
|
position = newPosition; |
|
|
|
} |
|
|
|
if(savedDirection != null) { |
|
|
|
checkInput(savedDirection); |
|
|
|
} |
|
|
|
|
|
|
|
gameManager.updatePlayerCell(); |
|
|
|
} |
|
|
@ -52,6 +56,10 @@ public class Player { |
|
|
|
boolean newPosIsWall = gameManager.map.GetCell(newPosition).type.equals("wall"); |
|
|
|
if(!newPosIsWall) { |
|
|
|
direction = input; |
|
|
|
savedDirection = null; |
|
|
|
} |
|
|
|
else { |
|
|
|
savedDirection = input; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|