Is it possible to detect a collision based on image point?

0 favourites
  • 9 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hey Construct Community,

    I'm trying to create a sword fighting system. Is there a way to detect when an enemy collides with the sword of the player sprite (Image Point 1) and not the whole player sprite?

  • You can adjust the collision mesh of the image by clicking the button below the image point button.

    It's called "Set collision polygon".

  • That doesn't work though because then the player's collision is tied to the sword (i.e he gets hit from behind but nothing happens because the collision is on the sword).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I´m trying to do the the same thing in my project, and right now I´m using three different collision boxes.

    Box one is the one I pin (using PIN-behavior) the character sprite to. This box handles the player movement.

    Box two, somewhat smaller than box one, is pinned (using PIN-behavior) to box one. I use this box to check if the player gets hit. (I made it a little smaller so the player doesn´t feel he gets hit unfairly)

    Box three is a rectangular box that I put on an image point I have on the sword´s edge. I don´t use PIN-behavior here (since you can´t PIN things to specific image points), but rather use: Every tick->set position to another object.

    I use box three to check if the sword hits the enemies.

    So far it seems to work ok, but I´ve just recently started this project, so we´ll see.

    I´m sure there are a lot of (probably better) ways to do this though.

  • You can do this using just using imagepoints. Here is an example.

    [attachment=0:1wu2arts][/attachment:1wu2arts]

    Enemies will only be destroyed if the overlap the imagepoint "swordpoint".

  • Minor

    Thanks for the example, it works perfectly!

  • This forum really saved me thanks alot.

  • Thanks , this post and Capx is very helpful, it saved me too .

  • Minor, awmace5 : Thank you!

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