How do I make Collision Area

0 favourites
  • 5 posts
  • Is there any way to make this image a Collision Area without doing it manually? PNG image with transparency. The player must be inside the Collision Area

  • You could quickly recreate that image with a tilemap and give it the solid behavior. Only the filled tiles will trigger a collision. This would probably be the fastest and easiest way to accomplish what you want, plus it is really easy to change later.

  • Any sprite (image you add by default has collision enabled. You can define the actual collision area or outline by setting the collision polygon properties. C doe attempt to do this automatically by generally needs modification for accuracy and for performance. More than 8 points can degrade performance if you have a lot of objects that have collisions enabled.

  • TheDom

    That works well if the player is outside the lines. In the case mentioned above, the OP said the player had to be inside. This means the collision polygon created by the image is the opposite of the collision polygon needed. The player is inside the lines while the area outside the lines represent the collision polygon. Also, as you mentioned, more than 8 points degrades the performance, so your suggestion would not be optimal anyway. The image above would require 18 points to create.


    You will get good performance and results if you use my suggestion above.

    I hope this helps you get what you need and good luck with your project.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see what you mean. Here's a solution too. For each straight line segment of the image, create an invisible sprite and draw(stretch) them along each line acting as invisible walls. The will be rectangular and only have 4 points. You can create image points if you need to and pin each one in position but, I don't think it will be necessary, you'll have to decide about that based on your specifics in the game. The just set the collisions property to disabled for the main image. Put all of the walls into Family for easy coding On Collision events. Then it works whether the player collides from inside or out.

    Might be a little easier too.

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