How do I jump on an enemy's head and hurt them?

  • Hi, if the player touches an enemy, the player loses health. (When player collides with enemy event) But I want it so the player can hurt the enemy if jumping on his head and the player takes no damages.

    I could make a sprite and pin it to the enemy's head, but I'm thinking there must be another way.

    Thanks for any help, sorry if it's a basic question, I'm still learning.

  • This is very good tutorial, try this one.

    scirra.com/tutorials/253/how-to-make-a-platform-game/page-7

  • Thanks buddy,I read through that tutorial and applied it, but this seems to be conflicting with the event.

    The ball loses one heart of health. I have tried a few things but to no avail? Any ideas?

  • This is very good tutorial, try this one.

    https://www.scirra.com/tutorials/253/how-to-make-a-platform-game/page-7

  • is moose a part of Family1? because if so your code is telling it that on collision with moose to subtract 1 from lives.

    maybe add two collision boxes to each (both the player's ball and the moose) to differentiate where the collision takes place, so you have a box for player's feet (or bottom of ball) and a box that represents "top/front/back" of player, and then a box that represents the "top" of the moose and another that covers the "bottom/front/back".

    then set it so if player's "bottom" collides with moose "top", destroy moose, add whatever to points

    BUT

    if player's "top/front/back" collides with moose "bottom/front/back" then subtract 1 from lives

  • is moose a part of Family1? because if so your code is telling it that on collision with moose to subtract 1 from lives.

    maybe add two collision boxes to each (both the player's ball and the moose) to differentiate where the collision takes place, so you have a box for player's feet (or bottom of ball) and a box that represents "top/front/back" of player, and then a box that represents the "top" of the moose and another that covers the "bottom/front/back".

    then set it so if player's "bottom" collides with moose "top", destroy moose, add whatever to points

    BUT

    if player's "top/front/back" collides with moose "bottom/front/back" then subtract 1 from lives

    Thanks buddy

    everything got really confusing with all the events and hitboxes. it makes sense what you said.

    In the end i done this and it works perfect. Thanks for your help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • woot woot, glad I could help

  • Thank you very much for sharing this buddy, But what is the parameter thing?

    Pick instance with uid function parameter?

    Thanks

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