Hi everyone,
I'm trying to create a flare system like one that a modern jet have.
It would work: User presses "X" -> Flares enabled (shot from the player-position at some points (math.random)) -> Flares for a specific timespan locked
-> After that span flares are available again
A flare is at the moment a filled circle with a radius of 4.
I tried it on many ways, but I got problems with the unique targeted point of a unique flare (unique positions of the flares, so a "rocket-pointing" system is possible).
I don't know how to handle the table with the coordinates where the flares are going to and how to go it one for one at different points, and not
all in one time.
I'm helpless, how would that be solved?
It would be very nice if someone explains a solution for that.
And sorry for my english, I hope it is understandable.
Problems/Questions creating a flare system
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Problems/Questions creating a flare system
"Docendo discimus" - Lucius Annaeus Seneca
Re: Problems/Questions creating a flare system
Hi,
I'd suggest you create a flare object which is created on every "X" pressed with
flare.x and flare.y as position.
Then, on every update you just have to for-loop every flare drawing closer to their target until they hit and the remove the flare...
Hope I got your problem right..
Cheers,
jimflim
I'd suggest you create a flare object which is created on every "X" pressed with
flare.x and flare.y as position.
Then, on every update you just have to for-loop every flare drawing closer to their target until they hit and the remove the flare...
Hope I got your problem right..
Cheers,
jimflim
Re: Problems/Questions creating a flare system
I've wanted to make a system for that for a while. I'm not certain I understand your specific question but here are my thoughts:
I'd have a table for each flare that was released:
flare.x
flare.y
flare.heading
flare.timer --just holds the time at which the flare was fired off
a function to release the flares:
--create a new flare table, set flare.heading to point behind or off to the side (and slightly random, not STRAIGHT back...), set x and y to the plane's x and y, set the timer to the current time (love.timer.getTime())
in this function that creates the flare you could decide whether it fired one or two at a time (big planes have two or more flare launchers, fighters generally use one I think).
in update(dt):
for each flare in the table, move it in the direction of heading. how fast should depend on the time the flare has been alive:
love.timer.getTime() - flare.timer
When flares are released they appear to go quickly, then slow down (optional)
I would also use the timer to determine the brightness of the flare, letting it fade after a while.
If I missed the point of the question or can help in some other way let me know.. like I said I've wanted to make a flare system for a while (my desktop background image is currently a C130 releasing hundreds of flares behind it.. it's inspiring)
I'd have a table for each flare that was released:
flare.x
flare.y
flare.heading
flare.timer --just holds the time at which the flare was fired off
a function to release the flares:
--create a new flare table, set flare.heading to point behind or off to the side (and slightly random, not STRAIGHT back...), set x and y to the plane's x and y, set the timer to the current time (love.timer.getTime())
in this function that creates the flare you could decide whether it fired one or two at a time (big planes have two or more flare launchers, fighters generally use one I think).
in update(dt):
for each flare in the table, move it in the direction of heading. how fast should depend on the time the flare has been alive:
love.timer.getTime() - flare.timer
When flares are released they appear to go quickly, then slow down (optional)
I would also use the timer to determine the brightness of the flare, letting it fade after a while.
If I missed the point of the question or can help in some other way let me know.. like I said I've wanted to make a flare system for a while (my desktop background image is currently a C130 releasing hundreds of flares behind it.. it's inspiring)
Re: Problems/Questions creating a flare system
Hi,
thank you very much for the approaches and possible solutions, I'm going to try it.
Karma is coming.
@rvj
Did you ever finish it?
One of the pictures that gave me the idea... http://www.popularmilitary.com/military ... y1110j.jpg
As you said, very impressive.
thank you very much for the approaches and possible solutions, I'm going to try it.
Karma is coming.
@rvj
Did you ever finish it?
One of the pictures that gave me the idea... http://www.popularmilitary.com/military ... y1110j.jpg
As you said, very impressive.
"Docendo discimus" - Lucius Annaeus Seneca
Who is online
Users browsing this forum: No registered users and 9 guests