Destroy created Object?

Get help using Construct 2

Post » Tue Apr 26, 2016 5:36 pm

Create Object A at (x,y) works just fine. Click on Object A > Destroy Object A doesn't work. Neither does moving it. I click on Object A at (x,y) and it doesn't destroy it. Destroy means Destroy, so why does the created object, an instance of Object A, stay active even though Click on Object A > Destroy Object A ?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Apr 26, 2016 5:39 pm

Object A was created at (x,y) I have it set so when you click on Object A, it destroys Object A. I am clicking on the Object A that was created at (x,y) so why is it not being destroyed? Destroy means Destroy. So Destroy Object A should Destroy Object A. So why is the Destroy function broken?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Apr 26, 2016 5:41 pm

Object A that was created at (x,y) is still Object A. So why is Destroy broken and fails to Destroy Object A at (x,y)
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Apr 26, 2016 5:46 pm

Aw...It was the Random function. I had to do Trigger Once while True. I figure Construct 2 checked the Random number and did it once. I did not put in a loop, but it looped it anyways. I think what happned was... Clicking destroyed the object, but since it was if Random = x then Create Object A at (x,y), as soon as Object A was destroyed, it created another Object A.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Apr 26, 2016 5:52 pm

you dont need to use random x to destroy an object if u have also the condition on clicked object... what happened was when u clicked a random X position was selected... from the width of the layout... and ur sprite was not on that X position... just use the mouse or the touch condition on object clicked or on object touched... then sprite.destroy... also you may want to next time to not post a new reply to your own post but edit the first one until u get a response. otherwise you will be flagged as spamming the board.
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests