1 Attachment(s)
Creating objects and saving memory
I'm doing some (hopefully) final tweaks on my project, but in trying to optimize it as best as possible for all platforms (basically PC and mobile), I've run into a conundrum.
I need to be able to continuously create enemies on screen, for the player to destroy, but also destroy any unused enemies, when they wander off screen, take relieve memory.
Here's an example of how I set it up.
Attachment 24852
I use the "NObjects < xx" to prevent entire clusters of these guys from forming on screen. But that creates a problem, if more of them wander off than the player is able to destroy. I need to constantly create enemies until the score reaches a certain number. Setting the limit too high, creates more enemies than is needed, and creating too little, causes the all activity to cease before the the desired score is reached.
I'm possibly overthinking it, but I've wracking my brain for days trying to figure this out.
TL; DR Need to constantly create objects without slowing down the game too much. :D
Thanks! I'm just wondering, though.
Thanks
@mobichan
, I like this a lot. My only issue is, I'm not sure how to go about recreating the current "swarm" effect that I have using the timers, and creating and destroying. That's what I'm after; the illusion of a swarm of critters invading the area that player must knock off one-at-time, to wrack up points. When I do it the current way, I have
+Every 00"xx
- Create Fly at (-15, 72)
- Create Fly at (-16, 283)
- (Fly) Set X position to Random(Frame Width)
- (Fly) Set Y position to RRandom(50, 300)
Also, I see that in the example you posted, that a double-click is what triggers the objects to appear on screen. I know timers slow things down in mobile apps, so I'm wondering if I should perhaps use global values as a timer?