How do I apply impluse

0 favourites
  • 9 posts
  • Hi,

    I have the enemy with physics behavior, and I wanted to apply an impulse at him when the player hit him with a shield.

    For now I have:

    "Shield -- On Collision with Enemy -- Apply impulse 100 at angle Self.Angle - 180 at image point 0"

    Why is that not working? Enemy does not even move.

    Thanks for your time.

  • Do you use "Apply impulse" action on Enemy object? Have you tried a bigger value, say 1000? (just to test)

    Are you sure the Enemy has physics enabled at the moment of collision, is not Immovable etc?

  • Does AI object have both platformer behavior and physics behavior enabled at the same time?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000, I tried numbers as 100000. Physics Enabled. The thing with 'Immovable' is that when I set it to 'no' the enemies fall down the layout; if I set it to 'yes' nothing happen.

    , No platform behavior.

    It's strange.

    Here's the enemy object status at /s/zax5jdxf7m5a920/Sem%20t%C3%ADtulo.png?dl=0

  • If you set immovable to yes they will be immovable, no matter how much impulse you apply. In order to keep them from falling you should create a ground or something, which must also have the Physics behavior... ... .capx?dl=1

    In this capx I apply the same impulse at the same angle to both objects everytime you click anywhere. See how they behave differently. Also, note that you don't have to add the Solid behavior to Physic objects. They already recognize one another as solids...

  • brunopalermo, but it's a top-down project. I would like to make the enemies not fall at all as if there was no gravity. The only physics input would be the impulse.

    I tried reducing the density an the properties of physics but don't worked. If I set immovable to 'no' they fall.

  • roboom

    Have you tried setting the gravity to 0?

    Immovable=yes should only be set for physics obstacles (scenery objects, ground, walls, trees etc.)

    Immovable objects can not be moved with physics actions.

    Also, you can try Chipmunk behavior:

    With Chipmunk you can set different gravity to different objects and at different angles (vectors).

  • As dop2000 mentioned, just use gravity 0.

    Check this capx for an updated example... ... 2.capx?dl1

    Click anywhere to apply an impulse from that point towards every object.


  • dop2000, yup, that's what I was missing, didn't knew about it, thanks!

    brunopalermo, nice, exactly what I wanted to do, thanks!


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