Enemy jump towards player...

Get help using Construct 2

Post » Fri Jun 08, 2012 5:15 pm

So the level 1 Hero is strolling through the grassy hills of the first part of the world. HE SPOTS A SLIME! Buuuuuut it's just bouncing up and down because the deity orchestrating the events doesn't know how to make it jump to the left or right depending on which side the player is on.

How do I make the slime jump to the left if the player is to the left of it, and to the right if the player is to the right of it?
B
18
S
2
G
1
Posts: 21
Reputation: 1,060

Post » Fri Jun 08, 2012 6:25 pm

As usual, there are many ways to do this.

I think one of the easiest ways is to put a Platform behavior on your enemy, but turn the default controls off. Then when an event occurs you can simulate jump, left and right controls. If the player gets within a certain distance of the slime, simulate right if player.x is greater than slime.x and left control if player.x < slime.x. Here is an example (created with release 93):

Slimed.capx

If you haven't checked out JohnnySix's patrolling example in the arcade, you should. Very cool example, and you can download the capx to see how he did it.kittiewan2012-06-08 18:30:04
B
29
S
11
G
12
Posts: 281
Reputation: 11,888

Post » Sat Jun 09, 2012 12:44 am

Thanks :)Linuto2012-06-09 00:45:00
B
18
S
2
G
1
Posts: 21
Reputation: 1,060


Return to How do I....?

Who is online

Users browsing this forum: linkman2004, supreme676 and 20 guests