Characters and physics

Get help using Construct 2

Post » Tue Oct 25, 2011 1:55 am

Hello!

I'm working on a sidescroller beat em up and just got some basics done with the enemies. Now I'm planning on doing some 'kickback' effects on them, like when player punches enemy hard enough to make them fly backwards, hit the wall and bounce off it.

What would be the most efficient way to make the enemy turn into sort of physics object, bounce around and then turn back to static after stopping?

Thanks in advance.
B
15
S
5
G
4
Posts: 214
Reputation: 3,124

Post » Tue Oct 25, 2011 6:31 am

Just do what you said.

on enemy hit:
enemy: spawn 'physics_enemy'
enemy: destroy.
physics_enemy: apply impulse.

on physics_enemy velocity < threshold*:
physics enemy: spawn enemy.
physics enemy: destroy.

*threshold should be a relatively low number, a speed of almost stopping.

I think that's correct, I have not had a play with physics yet, but I suppose that would work.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Tue Oct 25, 2011 6:05 pm

Hah, thanks. That was more simple than I expected. But how can I transfer the health back to the newly spawned enemy after the bouncing? These enemies come in packs so I can't make the health transfer for the entire type.

I'll try something tonight, but any help could be appreciated.
B
15
S
5
G
4
Posts: 214
Reputation: 3,124

Post » Tue Oct 25, 2011 6:13 pm

You can have the physics_enemy also have a health variable, so when it's created, set physics_enemy.health = enemy.health, and then when you recreate the enemy, set enemy.health = physics_enemy.health.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Tue Oct 25, 2011 9:32 pm

Yeah, that would work fine.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to How do I....?

Who is online

Users browsing this forum: bluemonkey, Khamsou and 23 guests