Characters and physics

0 favourites
  • 5 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • Yeah, that would work fine.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)