Page 1 of 1

Spawning meteors and then subsequently despawning them

Posted: Sat Dec 20, 2014 6:15 pm
by Carracer12
Hello!

I am very new to Love2D and thus do not have much of an idea as to how I can do this, I want to spawn/draw a meteor with a random direction falling towards the ground fairly regularly. I think I have that working, the next bit is spawning more than one and the regular part. I am stuck on this, I want to spawn up to maybe 3 or so of the objects at a time and despawn them once they hit the ground level.

If you could also help with hw I could do collision detection with my player character, please fire away!

Thanks in advance, will try to attach a .love file, tell me if you want the code put out in text too! The way I have done it may seem completely illogical, I was trying to learn dynamically by doing this project so please don't be confused about why i have music but can't get the basics to work :P
Thing.love
This is the .love file, ignore lots of the .lua files, many are failed ideas, only focus on "conf", "spawn", "main" and "player" please :)
(5.84 MiB) Downloaded 128 times
~Carr

Re: Spawning meteors and then subsequently despawning them

Posted: Sat Dec 20, 2014 9:20 pm
by Duster
Here you are. For simplicity's sake I've only included spawn.lua and main.lua, so you'll have to unzip the .love and replace your old files if you want to check it out.

I've heavily commented it so you know exactly what's going on. Truth be told I'm not too experienced myself, but I hope I did a decent job explaining everything in simple terms (and hopefully correctly...)

Re: Spawning meteors and then subsequently despawning them

Posted: Sun Dec 21, 2014 9:00 pm
by Carracer12
Ok, thank you very much!

Will take a look tomorrow when I have more time, seems like a really fun language to start learning :P

EDIT: Took a look at it, works brilliantly and comments make sense, thank you!!