How do I spawn without a problem with something weird happen

Get help using Construct 2

Post » Thu Nov 06, 2014 2:48 am

So. I want to do is this:

1. Click on a sprite, this sprite spawns a copy of this sprite (turret) to the mouse
2. Then, based on a grid, I can drop this spawned version anywhere on the grid
3. Continue doing that for as much as you can afford

Everything is working fine except that the game crashes
When I used the debugger, I saw that each turret set increases the object count exponentially.

For example, say I start with 10 objects, next turret I place, there's 11, then 13, then 16, then 21, then 42, then 84, then 168, then etc............and it grows until somehow it reaches like 8000 objects after placing only 10 turrets.

I don't see where in the code could cause this problem O.o
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 17
Reputation: 234

Post » Thu Nov 06, 2014 3:01 am

Can you just test with the mouse click (not pressing A) and see if it still does it? Because if you press A, ALL sprites will be picked and so will all spawn another sprite, etc. (althought the System Create method looks ok?)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Nov 06, 2014 3:04 am

Oh wow that's it! lol.
hmm I'll just get rid of the keyboard feature then.

Thanks so much for your help!
B
4
Posts: 17
Reputation: 234

Post » Thu Nov 06, 2014 4:29 am

You're welcome. Takes a while to get used to all the gotcha's with picking.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Jackriduk, kiki4construct and 35 guests