Log In  


Ok so, Im making a game where your a frog collecting fire flies and what I need help with is spawning the fire flies periodically on a random spot on screen. How would I do this as ive tried a few things that havnt worked. So, any suggestions or help would be great.

1


1

Fireflies make me think "tiny particles flying around the screen". You could try taking an existing particle system like https://www.lexaloffle.com/bbs/?tid=28260, studying it and adapting it to your game's needs (and it would be nice to give credit to the original author if you do).

To make them spawn periodically, you could make a timer variable that counts down in your _update function. Then whenever it reaches 0, it spawns a new firefly and resets. You'll probably want to use rnd() for randomizing their starting x/y location on screen, like x = rnd(128). Hope that helps!


Is something like this what you're looking for?

I made this last year for a similar purpose.

cart


Cart #bc_randpos-0 | 2025-02-24 | Code ▽ | Embed ▽ | No License



https://www.youtube.com/watch?v=X9qKODb-wXg&t=621s
this tutorial goes over programming entities, metatables, and spawning them in random locations. it's one of my favorites.



[Please log in to post a comment]