Simply X and Y detection

Get help using Construct 2

Post » Fri Feb 10, 2012 8:12 am

In platform game: when player is on 200 pixels on left of enemy or 200 pixels on right of enemy > enemy follow a player ?
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Fri Feb 10, 2012 8:24 am

Enemy X > Player.X+200     - Enemy, Simulate platform control walk left

Enemy X < Player.X-200     - Enemy, Simulate platform control walk right

Works for me. ;)
ImageImage
B
108
S
23
G
7
Posts: 1,062
Reputation: 12,683

Post » Fri Feb 10, 2012 8:32 am

Whih condition i must use to type this code?
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Fri Feb 10, 2012 8:42 am

Im not sure I understand

But its

Add Event
Choose enemy sprite
Compare X
Type in: "Player.X+200" and switch the box to Greater than if needed.
ImageImage
B
108
S
23
G
7
Posts: 1,062
Reputation: 12,683

Post » Fri Feb 10, 2012 8:53 am

ok i will try this :)
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Fri Feb 10, 2012 9:05 am

Do you know how to do. if you get too close to wasps, wasps flies to us ?
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Fri Feb 10, 2012 10:34 am

I think the most simple way to achieve your request is using a transparent sprite bigger than your Player gadget, pinned, so, check if this sprite is overlapping what you want, because if you start to check each distance, your game will slow down a bit.

Doing your second request:
> Wasps is overlapping the transparent sprite:
>> Change his sprite for Flying;
>> Move for where your want (use SIN for natural movements, or in line, just checking the Player position and then making his trace route for there), setting X and Y (click inside that second window and select the player, then, select the Player.X and Player.Y);

I think if you wish make them go to the player, you'll need make the Wisps a little bit dizzy on the path, or they will run directly to the player, making his movement unnatural.
Image
B
104
S
23
G
17
Posts: 1,350
Reputation: 22,028

Post » Fri Feb 10, 2012 10:42 am

Yeah sometimes the simple way is the best
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Fri Feb 10, 2012 11:48 am

Don't miss, you can use Families with the full version. Using Families you can put your monster all inside it and only check the overlapping of that Families.
Image
B
104
S
23
G
17
Posts: 1,350
Reputation: 22,028

Post » Fri Feb 10, 2012 12:52 pm

okej :)
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Next

Return to How do I....?

Who is online

Users browsing this forum: ashishv, conker23, IceManLT, morti and 3 guests