Text refuses to Destroy

Get help using Construct 2

Post » Thu Aug 22, 2013 12:27 am

Hi all, been experimenting with a shop system, and I've come up with the idea of invisible sprites that spawn the initial text buttons, and on press destroys the text buttons and spawns new ones.

The problem I'm having, is that when I press "Shop", all the text buttons EXCEPT "Shop" destroy perfectly and the new ones spawn.

Here's the capx: https://dl.dropboxusercontent.com/u/28499111/spacegameShopProblem.capx

Any ideas why this one refuses to disappear?   

As usual, any help appreciated!

Edit: Event sheet is the "station" one ReanimtedNerd2013-08-22 00:28:58
B
11
S
1
Posts: 40
Reputation: 485

Post » Thu Aug 22, 2013 12:31 am

Before I download this, since I've had similar issues in the past, do the following checks:

Is the event that spawns the text spawning more than once? You may need a 'Trigger Once' condition. You can see how many instances exist through the debugger (it is possible for multiple instances of text to be created and overlapping each other, giving the illusion that the text is never being destroyed even though it is).

Is the event that destroys the text firing at all? Add an event that destroys something else and see if that other thing gets destroyed. If not, then you know the event that destroys the text isn't firing at all.

If the event that destroys the text is not firing, start disabling conditions until it fires. You should be able to pinpoint which condition is the problem.Excal2013-08-22 00:32:07
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Thu Aug 22, 2013 12:33 am

I've set a global variable that only spawns the text on a paticular value, so I don't think it's that. The event that should destroy the Shop text is destroying all the other text, which is why I can't figure this one out...
B
11
S
1
Posts: 40
Reputation: 485

Post » Thu Aug 22, 2013 7:52 am

In Event 10 on the Station Event Sheet, disable the first line 'System: wait 0.5 seconds' and it works.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
131
S
29
G
81
Posts: 5,328
Reputation: 56,630

Post » Thu Aug 22, 2013 8:09 am

[QUOTE=ReanimtedNerd] I've set a global variable that only spawns the text on a paticular value, so I don't think it's that.[/QUOTE]

Your text is spawned every tick that condition is met, so who knows how many instances of the text object exist.

Add a trigger once while true to the spawning event and all troubles disappear.

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Aug 22, 2013 9:28 am

LittleStain is correct. If you add a debug text and set it to Shop.Count you will see it count up rapidly. Silly me always looking for quick fix :)
If your vision so exceeds your ability, then look to something closer.
Moderator
B
131
S
29
G
81
Posts: 5,328
Reputation: 56,630


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests