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
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

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
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Fri Feb 10, 2012 8:32 am

Whih condition i must use to type this code?
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

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
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Fri Feb 10, 2012 8:53 am

ok i will try this :)
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

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
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

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.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Fri Feb 10, 2012 10:42 am

Yeah sometimes the simple way is the best
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

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.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Fri Feb 10, 2012 12:52 pm

okej :)
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests