How do I Destroy Irregular Shapes

0 favourites
  • 11 posts
From the Asset Store
Template for an alternative to falling shapes, fully documented in comments and video
  • Hi Everyone,

    I have working right now a tile being destroyed when something collides with it but with rand you can only have rectangles. I want an irregular collision shape to destroy tiles that it touches. Is this even a possibility?

    Talk soon.

  • The first capx attached here should help:

    It highlights all the tiles that overlap the tiles, but you could then take that and clear those tiles.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • wow thanks for the super quick reply R0j0Hound! you are always a great help.

  • I tried substituting create object with erase and it doesnt work as i imagined it would. does erase work differently?

  • Event #2 creates all the Sprites in a rectangle and event #3 removes the sprites not overlapping. So to actually make it delete tiles you need a new event below all that:

    Mouse button is down

    for each tile

    --- tilemap: erase tile at (self.positionToTileX(tile.x), self.positionToTileY(tile.y))

    To make it only happen when you need it, put all the events in a group and disable/enable it as needed.

  • Thanks again for the help with this R0J0hound!

    This is what I got if I understand you correctly. It doesn't function just yet. In my game I have a little bomb that I want to erase terrain when its overlapping. I am going to keep fiddling with it and see if I can make it work.

    CAPX_DestroyIrregularShapes

  • I am embaressed to say i also don't understand why when comparing the tile index we check the value not equal to -1. I think maybe my errors are in my understanding.

  • "-1" just means there is no tile there. Your capx referenced tilemap instead of tile in the event which is a simple mistake. Anyways here's a working example. Instead of creating a bunch of tile sprites it just moves around one to do the detection. The advantage is it eliminated a few events.

    https://dl.dropboxusercontent.com/u/542 ... pping.capx

  • most excellent. Thank you R0j0hound for all your help. I cannot wait to test when I get home.

  • this method works perfectly. I my personal game script I have it on animation playing erase tile. Very good and thanks again.

  • Glad it works for you.

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