0 Favourites

How do you make a enemy follow you?

  • When i mean following is that the enemy has it's usual movements but it will always be on screen. The enemy i am thinking of is a floating enemy. So i don't want to know how a enemy on ground would be able to follow you i want to know how a enemy that floats in the air follow you. Basically so should the enemy move whit the screen and adjust it's position to the player while still moving around. So how do you make this work?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • When i mean following is that the enemy has it's usual movements but it will always be on screen. The enemy i am thinking of is a floating enemy. So i don't want to know how a enemy on ground would be able to follow you i want to know how a enemy that floats in the air follow you. Basically so should the enemy move whit the screen and adjust it's position to the player while still moving around. So how do you make this work?

  • If you could give a better explanation of what you want it would be easier to help..

    Would putting the enemy on a layer with 0,0 parallax and having it move on it's own be what you are looking for?

  • If you could give a better explanation of what you want it would be easier to help..

    Would putting the enemy on a layer with 0,0 parallax and having it move on it's own be what you are looking for?

    My enemy doesn't move like this but let's say the enemy moves up and down . The enemy should keep moving up and down it should keep moving up and down but it shall always be on screen. Basically the enemy should always be on screen.

  • > If you could give a better explanation of what you want it would be easier to help..

    >

    > Would putting the enemy on a layer with 0,0 parallax and having it move on it's own be what you are looking for?

    >

    My enemy doesn't move like this but let's say the enemy moves up and down . The enemy should keep moving up and down it should keep moving up and down but it shall always be on screen. Basically the enemy should always be on screen.

    Without better explanation it is hard to guess what you want..

    The enemy won't move if you don't give it a movement behaviour (or code the movement yourself)

    You could put it on a layer with paralax 0,0 to keep it on screen , clamp it to the viewport or a certain distance from the player end there are more options..

    How free would the movement of the enemy be?

  • Sound like you want the enemy to haunt the player. I done something similar but it was for a menu based. Try this have a sprite_holder to anchor down now put two variable Self.X and Self.Y

    run this if sprite_holder is on screen set its X and Y to the variable. Next for the enemies you want to Set X position to Sprite_holder.self.X Im guessing to put this also If enemy is on screen.

    What this will do is that since Sprite_holder has an anchor behavior It will keep its spot relative to the game window. And there by you will alway have the X value already in place with the variable so that you can pull that X value to be used for the enemy to know how far away and you can use the Y too for the left n right only.

    Note this will work for only Up n down or Left n right.

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