Spawning meteors and then subsequently despawning them

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Carracer12
Prole
Posts: 9
Joined: Mon Dec 08, 2014 8:24 am

Spawning meteors and then subsequently despawning them

Post 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 126 times
~Carr
User avatar
Duster
Prole
Posts: 32
Joined: Fri Dec 19, 2014 8:34 pm
Location: Ontario, Canada

Re: Spawning meteors and then subsequently despawning them

Post 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...)
Attachments
spawn&main.love
Meteors ahoy!
(2 KiB) Downloaded 127 times
Carracer12
Prole
Posts: 9
Joined: Mon Dec 08, 2014 8:24 am

Re: Spawning meteors and then subsequently despawning them

Post 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!!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests