game

Hello guys i am making a little console game, but how can i make the enemy attack the player?
Your question is vague, but whether it's a console game or a game using a graphics library, you'd need to have some sort of AI for the enemy. Try thinking about how to make the enemy go closer to the player each iteration, being grid-based makes this easier to calculate*. Then, for every iteration that the enemy is within 1 grid tile to the player, the player takes a certain amount of damage.

*ex: if (player's x coordinate is larger than the enemy's x coordinate), have the enemy shift over 1 right, else have the enemy shift over 1 left. Same for y axis.
Last edited on
@Ganado sorry its not console game haha.. the game is, like text ,you will choose in between battle or shop then if battle you will choose between attack and run
Topic archived. No new replies allowed.