How do I make my enimies move using 4 directional movement?

0 favourites
  • 8 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I currently making a dungeon crawler, I'm Using 4 directional movement to control the character and mirror it when looking left.

    I have been trying to make AI, I have only made AI for SideScrollers and Top down games. The one I'm currently working on looks at a slight angle.

    I'm use to making the AI by setting it towards the player X,Y and then using bullet to make it move towards the player. I have tried to do this but it is not working.

    I want it to move just like my player.

    Is there anyway to do this?

  • It should work so there's a problem with your events I guess. You could use 'simulate control', give your enemy the 8-direction behaviour and based on certain conditions have it simulate presses up down left right etc, that would move the enemy. You can also do the same with the tile movement behaviour, that might be useful for your game. Also there is a 4th option to use pathfinding and have the enemy find a path to the player.

  • How would i do this?

  • With either 8-direction or tile, you would compare the x and y of the enemy to the player and based on this side 'simulate control' toward the player. Because you're using 4-direction only it's not really clear what you want the movement focus to be on, if it should just run left across the screen and then down or down and meet the player y and then left towards the player, but you can order the logic so it chooses one direction first. That seems the most suitable for what you are trying to describe.

    Pathfinding may also be suitable, you do enemy find path to player, on path found move along path and disable diagonal movement.

    With the bullet behaviour you would use set enemy angle toward player but it would move at diagonals toward the player.

  • Im going to use bullet.

    It works ok but i was wondering it it where possible to stop it looking at me.

    Like this:

    I dont want it to move like that because it ends up going upside down, I want it to be like my player where it is allways up, is there a way to do this?

    I tried using a pin and an invisable cube but this did not work.

    I would also like to mirror and unmirror it when moving left or right can this be done? I have done this for my player but have no clue how to do it for the enemy.

  • Yeah you uncheck the option in bullet behaviour, 'Set Angle'. This option sets the angle of the object to the direction it is moving in. You don't want this so you can disable that option.

  • I have done this and its just walks of the screen ingnoring solids.

    Have I got it set up in correctly?

    I cant even add this:

    (Marker is attached to the player and is the only way for bullet to find the position of the player)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Im not sure what to do, everything i have tried either ends up with the enemy standing still, or walking to the side of the screen

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)