Collision Detection

0 favourites
  • 5 posts
From the Asset Store
Detects any kind of ad blocker. Very easy implementation into already existing projects
  • Hi,

    I'm trying to make myself familiar with Construct 2 so I tried to clone the game DiveKick. It feels pretty easy at first and I've run onto some bugs with but I sorted them through reading posts on the "How do I...".

    Now here's the issue I've run into. Let's say Player A successfully divekicks Player B. Instead of counting the counting the score for Player A, it adds to Player B. It's having trouble determining which sprite actually hits the other sprite.

    What I did first is compare the "Y" axis. It works fine for this specific game. But what if I'm to build a real fighting game. Does collision detection have something to do with zorder?

    Any idea how to let the code know which sprite is actually doing the hit?

    Let me know if it sounds confusing.

    Thanks!!!

  • The 'on collision with' command Picks the Object that has the Collision. An easy way would be to use different sprites for each player:

    If Sprite1 Collision with Sprite2 then...

    Sprite1.Health = Sprite1.Health - 10

    Sprite2.Score = Sprite2.Score + 1

    even if you have 10 Sprite1 and 10 Sprite2 it would pick these exact two.

  • Collisions are only concerned with whether the object collision polygons are overlapping. They are not affected by Z order or anything else.

    In a fighting game you'd need to apply your own logic to collision events, such as: if colliding and player A is attacking and player B is not blocking, hurt player B; else if player B is attacking and player A is not blocking, hurt player A, etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the response!

    Yeah, I guess this is where something like hit priority and character blocking takes place.

  • I finally got my collision detection working, but I cant get my player box to knockback after being hit.

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