How do you make a enemy follow you?

Get help using Construct 2

Post » Thu Nov 05, 2015 9:15 pm

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?
Last edited by Calfuso on Thu Nov 05, 2015 9:16 pm, edited 1 time in total.
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Thu Nov 05, 2015 9:15 pm

Calfuso wrote: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?
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Thu Nov 05, 2015 9:28 pm

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Nov 15, 2015 11:42 am

LittleStain wrote: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.
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Sun Nov 15, 2015 11:52 am

Calfuso wrote:
LittleStain wrote: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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 16, 2015 3:03 pm

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.
B
52
S
24
G
6
Posts: 391
Reputation: 7,845


Return to How do I....?

Who is online

Users browsing this forum: dop2000, Yahoo [Bot] and 36 guests