How do I solve this ?? PLEASE !!

0 favourites
  • 7 posts
  • Hi

    this problem drove me crazy ,

    in the file attached ( Demo. Capx) you will find a tilemap with One red squire object.

    tile is able to destroy when mouse or touch is triggered over.

    what i want is :

    when the closet tile to RED is destroyed ( erased : 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 ) , system should create Red object at the position of that erased tile and and keep

    creating as long as tiles been destroyed beginning from ( 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8) and so on.

    HOW TO Do THAT ??

    am Looking for my life saver here

    here is the capx

    dropbox.com/s/w2fzfovg0ec9edb/demo.capx

  • https://www.dropbox.com/s/wqerw7nmya038 ... .capx?dl=1

    If you need explaining, just give me a shout.

    (Or if this is not what you need)

  • that's amazing ,, thanks "randomly" u r the best

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Forgot one thing:

    You should probably add two conditions

    red.X IS NOT between Touch.X-tilewidth/2 and Touch.X+tilewidth/2
    and
    red.Y IS NOT between Touch.Y-tileheight/2 and Touch.Y+tileheight/2[/code:1h587mh5]
    
    (via system condition "is between values" and inverting that by rightclicking and choosing "invert")
    
    This prevents the system to create a new "red" object when the old "red" object is being clicked.
  • thanks for this correction , could you please uploud capx describe this corrections ?! i am facing problems do this by my own .

    best Regards

  • by the way ,,what you meant by ( 1.5 ) that's appear in (red.X-tilewidth*1.5 )

  • So, .capx is updated with the added conditions.

    (Left out some information in my last post, sorry for that)

    Now to "tilewidth * 1.5".

    Refer to this very beautiful Paint drawing:

    The condition used in the CAPX checks whether the user clicked any of the tiles 1 to 8 (numbered by you).

    It does this by checking whether the user clicked ANYWHERE around the red tile. Since the red tile's origin (from where calculations start) is in its center, it's half the tile height/tile width away from the tile's edge.

    So to get from red's center to the outer edge of the adjacent tiles, we need to add half of the tile's height/width plus another full tile height/width.

    The condition now checks whether the user clicked anywhere between the outer edges of the 3x3 grid of tiles around the red tile.

    Only when this is the case, a new red sprite is being created.

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