Destroy an object and everything pinned to it without con...

Get help using Construct 2

Post » Sat May 27, 2017 4:19 pm

Can I destroy an object and everything pinned to it without a container?

Image
I tried using pinnedUID but the documentation is very confusing to me.
Why did I still need instance variable if there is pinned UID? Why did I need pinned UID when I can just save UID right after the object was created and pinned. What is pinned UID for exactly and how to use it?

Thank you :)
B
8
Posts: 10
Reputation: 322

Post » Sat May 27, 2017 4:27 pm

Maybe you can do like this :
for each "sprite2" is overlapping "sprite" ~> destroy
B
18
S
8
G
2
Posts: 48
Reputation: 2,504

Post » Sat May 27, 2017 4:58 pm

Message: whitephon can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
mehrshadfarahani wrote:Maybe you can do like this :
for each "sprite2" is overlapping "sprite" ~> destroy


That will destroy all sprite2 overlapping with sprite1. Besides, it don't need for loop to do the same thing.

I want to create UI. Let say bar, close button, panel, etc pinned to one window title. And when the window title destroyed, every items pinned to that will also destroyed, but I don't use container because there will be many kind of UI using the same asset to save filesize and event (it's free edition :v).
Thanks for the answer.

this is my capx file
https://www.dropbox.com/s/mh072xom9h198 ... .capx?dl=0

EDIT:
Hey but that gives me an idea.
Image
It works but It still feels weird though
Last edited by whitephon on Sat May 27, 2017 5:21 pm, edited 2 times in total.
B
8
Posts: 10
Reputation: 322

Post » Sat May 27, 2017 5:15 pm

whitephon wrote:
mehrshadfarahani wrote:Maybe you can do like this :
for each "sprite2" is overlapping "sprite" ~> destroy


That will destroy all sprite2 overlapping with sprite1. Besides, it don't need for loop to do the same thing.

I want to create UI. Let say bar, close button, panel, etc pinned to one window title. And when the window title destroyed, every items pinned to that will also destroyed, but I don't use container because there will be many kind of UI using the same asset to save filesize and event.
Thanks for the answer.

this is my capx file
https://www.dropbox.com/s/mh072xom9h198 ... .capx?dl=0


I use IID to fix this bug . because "sprite" and "sprite2" created in the same time . so they have same IID .Image
B
18
S
8
G
2
Posts: 48
Reputation: 2,504

Post » Sat May 27, 2017 5:27 pm

Message: whitephon can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
mehrshadfarahani wrote:
whitephon wrote:
mehrshadfarahani wrote:Maybe you can do like this :
for each "sprite2" is overlapping "sprite" ~> destroy


That will destroy all sprite2 overlapping with sprite1. Besides, it don't need for loop to do the same thing.

I want to create UI. Let say bar, close button, panel, etc pinned to one window title. And when the window title destroyed, every items pinned to that will also destroyed, but I don't use container because there will be many kind of UI using the same asset to save filesize and event.
Thanks for the answer.

this is my capx file
https://www.dropbox.com/s/mh072xom9h198 ... .capx?dl=0


I use IID to fix this bug . because "sprite" and "sprite2" created in the same time . so they have same IID .Image


Woooooooo. Thank you!
It worked :D I don't know what it is for before.
B
8
Posts: 10
Reputation: 322

Post » Sat May 27, 2017 5:35 pm

Put all Pin-nable sprites inside a family: ALL_PINNABLE
Give the family an Global Var: PIN_UID

On Pin | Set ALL_PINNABLE.PIN_UID to [Sprite.UID]

On Sprite Destroyed |
> Pick ALL_PINNABLE where ALL_PINNABLE.PIN_UID = Sprite.UID | Destroy ALL_PINNABLE
Image Image Image
B
29
S
11
G
27
Posts: 730
Reputation: 17,002


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests