How do I solve this ?? PLEASE !!

Get help using Construct 2

Post » Wed Nov 02, 2016 10:18 pm

Message: marylander can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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 :oops:

here is the capx
https://www.dropbox.com/s/w2fzfovg0ec9edb/demo.capx?dl=0

Image
B
3
Posts: 4
Reputation: 183

Post » Wed Nov 02, 2016 10:46 pm

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)
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Nov 02, 2016 10:55 pm

that's amazing ,, thanks "randomly" u r the best
B
3
Posts: 4
Reputation: 183

Post » Wed Nov 02, 2016 11:09 pm

Forgot one thing:

You should probably add two conditions
Code: Select all
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


(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.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Nov 02, 2016 11:32 pm

thanks for this correction , could you please uploud capx describe this corrections ?! i am facing problems do this by my own .
best Regards
B
3
Posts: 4
Reputation: 183

Post » Wed Nov 02, 2016 11:34 pm

by the way ,,what you meant by ( 1.5 ) that's appear in (red.X-tilewidth*1.5 )
B
3
Posts: 4
Reputation: 183

Post » Thu Nov 03, 2016 1:01 am

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:
Image
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.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Zzarkz and 32 guests