Enemy hit detection not working properly

0 favourites
  • 10 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • I have been scratching my head trying to figure out why i cannot get the detection to work properly with this particular enemy. Its a slime that has platform movement, all it does is walk back and forth.

    here's the problem:

    Whenever you properly jump on him sometimes, you get hit anyways when really you are supposed to have killed it.

    These are the guys causing the problem:

    <img src="http://i45.tinypic.com/inhicx.jpg" border="0">

    Here's my crappy coding. I'm sure there's a lot better way but I'm still learning. But this is what i have set up for his collision

    <img src="http://i45.tinypic.com/e6d7hh.jpg" border="0">

    Here's also a link to a build of Super Ubi Land that I created just to get help on this issue. It's only one level unlocked and it has a couple of the enemies that I am talking about. play around and you'll notice how annoying those slime things are because of the bad set up for collision.

    Game Build

    Can someone please help?

    Thanks in advance! <img src="smileys/smiley31.gif" border="0" align="middle">

  • Stomping works for me ! ( Chrome )

    Note : Nice progress !!

  • It was working for me as well, maybe a slight problem if you hit the monster on the side before hitting the ground.

    Alternatives to Y < Y though could be using a marker to check for overlaps. Imagine you have a marker at his feet, this marker doesnt touch enemies when hit side on but when you jump on them the event would be :

    Player on collision with Enemy

    Marker is overlapping enemy           -> do what you want.

  • It works for me too most of the time. Though sometimes it doesn't connect properly. It happened with one of the goggled birds too, so it's maybe not contained to only the blobs. Maybe try adding "PLAYBOX is falling" to the collision event?

    I noticed something else too. If you press down repeatedly when entering the door the character might get stuck when the level starts.

    Also, I'm guessing the Mario sounds are only placeholders? :P

  • It worked for me too... BTW nice graphics and gameplay

  • Thanks guys!

    Hm... it's strange though because I get a lot of deaths due to the detection not feeling 'correct.' I will continue to play around with the code.

    GenkiGenga how would I set up markers and things like that from what you were suggesting? Would I use the pin function?

  • You can use the pin behaviour, but just setting the XY position every tick would do the same thing.

  • Yeah pin/setting X-Y would be fine.

    I like using image points though. If Ubi is always attached to a platformer object - then create a new image point (on your platformer object) and call it "Stomp"

    Then you can use:

    Every tick -> Marker, set position to another object : Platformer object AND image point : "Stomp".

  • ahh, I see. Ok thanks for the tip. I will give it a go and see how that works :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No worries, keep up the good work ;)

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