How do I make my enemy jump [Platformer]

Get help using Construct 2

Post » Sat Jan 03, 2015 2:48 am

Hi everyone,

I've been watching and reading many tutorials, but after hours of looking, I haven't found the answer to this (even though I learned some other cool things).

I am trying to to make a platformer/shooter game where one of the enemies chases you around to hit you. I want my enemy to be able to chase you even by jumping to another platform. So far I've only been able to make him float and chase me around using Line Of Sight, but I can't make him land bound.

Any advice on this? Thanks in advance.

"Enemy" has Line of Sight, Bullet, and Bound to Layout for Behavior.
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 38
Reputation: 301

Post » Sat Jan 03, 2015 8:45 am

If you put platform behavior for the enemy, Set Default Controls to No and Use Simulate Jump action.

As for the condition when to jump, use invisible sensors (check if enemy overlaps sensor), then enemy jumps.

Adjust Enemy's platform parameter Jump Strength to your preference.

ktb
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sat Jan 03, 2015 10:35 pm

@sgn15
It...Sort of worked. My enemies chase me bouncing (I assume because they're following PlayerBox.X and since the box is smaller, they're looking down while walking. I'm not sure about this.

What do you mean by invisible sensors? I'm afraid I haven't learned that one yet.
I tried making it so that a condition (PlayerBox.Y) is higher than Enemy.Y would trigger them to jump every 2 seconds, but they would just continue doing that regardless, because PB's Y was always Higher.
I'm kinda lost right now.
B
5
Posts: 38
Reputation: 301

Post » Sun Jan 04, 2015 3:42 am

Any object that is set to invisible during the game itself and its only purpose is to act as enemy's sensor/detector (which is done by overlapping)

I'm not sure which is your player in the pic and which is your enemy and what is that circle with an L in it, but I don't think you need to check your X and Y for enemy to jump. Just check if enemy overlaps the sensors (which you should put in the layout before runtime) then simulate jump.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sun Jan 04, 2015 5:20 am

@sgn15

I guess I'll place sensors on top of the platforms and I'll let you know.
For now the green squares is my player and the red the enemy. The L icon is a placeholder for ammo pickup.

Do you have any advice on how to make the enemy square move forward like my player? Right now when it moves forward it sort of tilts forward.

In any ways, thank you very much for answering, and I'll keep you posted on how it goes :D
B
5
Posts: 38
Reputation: 301

Post » Sun Jan 04, 2015 5:43 am

Still not sure about the overall theme of your game, is that thin line a platform (jump thru or solid) ?

If it's a horizontal layout and you keep on running and enemies chase you, place thin vertical line sensors on each area where enemy needs to jump

Use Vector X to make any object with platform behavior to move horizontally, Vector Y to make it move vertically. You can use vector X while jumping
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sun Jan 04, 2015 2:59 pm

@sgn15
Yes, that thin line is a platform, jump-thru. I wonder if that's why when I jump on it I stay and the others fall through it.

I understand sensors, but why vertical instead of horizontal?
B
5
Posts: 38
Reputation: 301

Post » Sun Jan 04, 2015 3:17 pm

If player and enemies are running horizontally, then you pass through the vertical sensors. I mean "vertical" as a thin long vertical line (shape of sensor).

Not sure if we are misunderstanding each other.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sun Jan 04, 2015 4:20 pm

See if the attached capx helps. It's not 100% what your asking for but it get's the enemy chasing the player when in sight, and the enemy will jump onto platforms if the player Y position is less than the enemy Y position, the player is not falling, and the enemy hits the sensor (called jumpbox in the capx).

And there's no angle changes in the enemy.

I'm sure there's better ways to do this, but hopefully it will help.
You do not have the required permissions to view the files attached to this post.
B
10
S
2
G
1
Posts: 42
Reputation: 798

Post » Tue Jan 06, 2015 3:20 am

@nickl this was EXACTLY what I needed.
It took me some time to understand the events, but I get it now. Thank you guys, I'm making progress :)
Please let me know if I can help you with anything (testing, etc).
B
5
Posts: 38
Reputation: 301

Next

Return to How do I....?

Who is online

Users browsing this forum: Instrex and 22 guests