Enemy Movement
Data Run » Devlog
Enemies are now able to move correctly. The following code is the moveEnemy function, which takes in a pointer to all the tiles:
for (int i = 0; i < movement; i++) { if (!moveForward(tiles)) { turnEnemy(tiles, 4); i += 2; } }
Each tile has a blocked bool, and the moveForward function checks if the tile ahead is blocked, then moves the enemy one square forward based on their rotation. If they cannot move, moveForward returns false, and the enemy is instead turned. Currently they simply turn 180 degrees, which uses up two points of movement.
Get Data Run
Data Run
A short adventure game made for a university project
More posts
- PostmortemApr 11, 2019
- Enemy DetectionApr 11, 2019
- IsometricApr 11, 2019
- Fully StartingJan 15, 2019
Leave a comment
Log in with itch.io to leave a comment.