How do I spawn without a problem with something weird happen

0 favourites
  • 4 posts
From the Asset Store
In this template the music plays without looping in your game
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?)

  • Oh wow that's it! lol.

    hmm I'll just get rid of the keyboard feature then.

    Thanks so much for your help!

  • You're welcome. Takes a while to get used to all the gotcha's with picking.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)