Platformer - getting damaged and jump back

Get help using Construct 2

Post » Sun Apr 15, 2012 6:48 pm

I'm working on a platformer and I'm trying to figure out how to make the player jump backwards and become invincible for a few seconds when he hits a enemy/spikes. It's common in many platforming games.

Like this

What would the right term be? Knockback?Cpryd0012012-04-15 22:13:02
B
20
S
5
G
5
Posts: 66
Reputation: 4,515

Post » Mon Apr 16, 2012 2:24 am

Manipulate the VectorX and VectorY expressions for knockback, and manipulate a variable for being invisible...
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,465

Post » Mon Apr 16, 2012 3:22 am

and during your knockback be sure to disable the platform behavior on the player
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Mon Apr 16, 2012 9:35 am

[QUOTE=sqiddster] Manipulate the VectorX and VectorY expressions for knockback, and manipulate a variable for being invisible...[/QUOTE]

Eeer, what?

Oh, I get it!

there's VectorX and VectorY expressions in the platform behavior. What's the difference between VectorX,Y to Set X, Y? Is it that it's animated smoothly?

Edit : Also, here is the capx file for anybody who wants to see it.Cpryd0012012-04-16 09:53:37
B
20
S
5
G
5
Posts: 66
Reputation: 4,515

Post » Mon Apr 16, 2012 3:51 pm

the difference is:

Vector will trace a path;
Set will pop the object directly, without transaction, to the point;
ImageImageImageImageImageImage
Image
B
95
S
21
G
16
Posts: 1,337
Reputation: 20,975

Post » Mon Apr 16, 2012 5:40 pm

for short invincibility for the player after he gets hit, put the events (for the hit and damage) inside a group, and on hit, disable that group for like 2 seconds or whatever you want then enable it again

for jumping back, like the guys said, set the vector x to + or - depending on which side the enemy is on. to determine which side of the player the enemy is on, you can create an event condition like:
if Player.X < Enemy.X (for player on the left)
--> set Player vector x to -300 or something
if Player.X > Enemy.Y (for player on the right)
--> set Player vector x to 300 or something

hope that helps :)
B
16
S
3
G
4
Posts: 40
Reputation: 3,877


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest