So, I have a game where you are a plane. It's based off of RC Plane Sim - 2, so you are flying and turning by pointing in different directions. How do I get many bullets (say 5 or 10) to fire, but not fire all at once?
I know it has to do with a firing variable or something, but I'm not sure.
Last edited by firedrake969_test (2012-12-05 12:54:12)
Offline
Using a sprite for each bullet, something like this:
Anywhere:
when gf clicked forever if <key [space v] pressed?> broadcast [fire v] and wait wait (2) secs // interval between bursts after all bullets are done movingFor the bullets:
when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim wait (0.2) secs // increase the time for each cannon ball so they fire in sequence show repeat until<touching [edge v]?> move (4) steps // not to big or the bullets may phase through objects end hide
Offline
MoreGamesNow wrote:
Using a sprite for each bullet, something like this:
Anywhere:when gf clicked forever if <key [space v] pressed?> broadcast [fire v] and wait wait (2) secs // interval between bursts after all bullets are done movingFor the bullets:when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim wait (0.2) secs // increase the time for each cannon ball so they fire in sequence show repeat until<touching [edge v]?> move (4) steps // not to big or the bullets may phase through objects end hide
Do I need 2 sprites/bullet? or can I just do both scripts in one bullet?
Offline
firedrake969_test wrote:
MoreGamesNow wrote:
Using a sprite for each bullet, something like this:
Anywhere:when gf clicked forever if <key [space v] pressed?> broadcast [fire v] and wait wait (2) secs // interval between bursts after all bullets are done movingFor the bullets:when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim wait (0.2) secs // increase the time for each cannon ball so they fire in sequence show repeat until<touching [edge v]?> move (4) steps // not to big or the bullets may phase through objects end hideDo I need 2 sprites/bullet? or can I just do both scripts in one bullet?
You can put both scripts in one bullet, but you only need it in the first bullet. You will, however, need multiple bullets to really simulate a machine gun firing.
Offline
MoreGamesNow wrote:
firedrake969_test wrote:
MoreGamesNow wrote:
Using a sprite for each bullet, something like this:
Anywhere:when gf clicked forever if <key [space v] pressed?> broadcast [fire v] and wait wait (2) secs // interval between bursts after all bullets are done movingFor the bullets:when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim wait (0.2) secs // increase the time for each cannon ball so they fire in sequence show repeat until<touching [edge v]?> move (4) steps // not to big or the bullets may phase through objects end hideDo I need 2 sprites/bullet? or can I just do both scripts in one bullet?
You can put both scripts in one bullet, but you only need it in the first bullet. You will, however, need multiple bullets to really simulate a machine gun firing.
Say I press space once. Will it only fire 1 bullet?
Offline
Firedrake969 wrote:
MoreGamesNow wrote:
firedrake969_test wrote:
Do I need 2 sprites/bullet? or can I just do both scripts in one bullet?
You can put both scripts in one bullet, but you only need it in the first bullet. You will, however, need multiple bullets to really simulate a machine gun firing.
Say I press space once. Will it only fire 1 bullet?
It depends; if you have one bullet, yes, but if you have more, no.
Offline
Is there a way to do it where it behaves like a real machine gun? i.e., you can fire 1 bullet, or 10 bullets.
Offline
firedrake969_test wrote:
Is there a way to do it where it behaves like a real machine gun? i.e., you can fire 1 bullet, or 10 bullets.
Yes, though I wouldn't like typing up the script. I'll see if I can create the script in a project for you tomorrow morning.
Offline
ErnieParke wrote:
firedrake969_test wrote:
Is there a way to do it where it behaves like a real machine gun? i.e., you can fire 1 bullet, or 10 bullets.
Yes, though I wouldn't like typing up the script. I'll see if I can create the script in a project for you tomorrow morning.
Ok.
Offline
Firedrake969 wrote:
Ready?
No, because my parents and I went shopping for folders and lights for the past 1~2 hours, and my mom just called for me to help decorate the Christmas tree in my house, but once I'm done with that, I should start working on it. It shouldn't be too hard to make.
Offline
ErnieParke wrote:
Firedrake969 wrote:
Ready?
No, because my parents and I went shopping for folders and lights for the past 1~2 hours, and my mom just called for me to help decorate the Christmas tree in my house, but once I'm done with that, I should start working on it. It shouldn't be too hard to make.
Oh, xD
Offline
Firedrake969 wrote:
ErnieParke wrote:
Firedrake969 wrote:
Ready?
No, because my parents and I went shopping for folders and lights for the past 1~2 hours, and my mom just called for me to help decorate the Christmas tree in my house, but once I'm done with that, I should start working on it. It shouldn't be too hard to make.
Oh, xD
It's finished!
(link to project)
Last edited by ErnieParke (2012-12-08 15:07:02)
Offline
Can you give me a screenshot of the script? I am using chrome, if that explains anything.
Offline
Firedrake969 wrote:
Can you give me a screenshot of the script? I am using chrome, if that explains anything.
No. From what I know about chrome, it doesn't, though before I do post the scripts, I have a question; couldn't you just download the engine I made you and, if you wanted, export the sprites so that it doesn't look like you remixed a project of mine?
Offline
ErnieParke wrote:
Firedrake969 wrote:
Can you give me a screenshot of the script? I am using chrome, if that explains anything.
No. From what I know about chrome, it doesn't, though before I do post the scripts, I have a question; couldn't you just download the engine I made you and, if you wanted, export the sprites so that it doesn't look like you remixed a project of mine?
No, because I'm remixing a project and adding the machine gun scripts.
Offline
Okay. Now for the machine gun:
when gf clicked set [Ammo v] to (500) set [bullet v] to (0) delete [all v] of [bullets v] add [1] to [bullets v] add [2] to [bullets v] add [3] to [bullets v] add [4] to [bullets v] Filler.//Repeat for the # of bullets you'll have. forever if <<(mouse down?) and <(ammo) > (0)>> and <(length of [bullets v]) > [0]>> change [Ammo v] by (-1) set [bullet v] to (item [1 v] of [bullets v]) delete [1 v] of [bullets v] wait (0.1) secs//Delay. end go to front
when gf clicked forever point towards [mouse pointer v]
when gf clicked forever if <(Bullet) = (1)> show go to [machine gun v] point in direction ([direction v] of [Machine Gun v]) move (30) steps repeat until (touching [edge v]?) move (5) steps end if <(Bullet) = (1)> set [Bullet v] to (0) end add [1] to [bullets v] end hide
when gf clicked forever if <(Bullet) = (2)> show go to [machine gun v] point in direction ([direction v] of [Machine Gun v]) move (30) steps repeat until (touching [edge v]?) move (5) steps end if <(Bullet) = (2)> set [Bullet v] to (0) end add [2] to [bullets v] end hide
Offline
ErnieParke wrote:
Okay. Now for the machine gun:
when gf clicked set [Ammo v] to (500) set [bullet v] to (0) delete [all v] of [bullets v] add [1] to [bullets v] add [2] to [bullets v] add [3] to [bullets v] add [4] to [bullets v] Filler.//Repeat for the # of bullets you'll have. forever if <<(mouse down?) and <(ammo) > (0)>> and <(length of [bullets v]) > [0]>> change [Ammo v] by (-1) set [bullet v] to (item [1 v] of [bullets v]) delete [1 v] of [bullets v] wait (0.1) secs//Delay. end go to frontwhen gf clicked forever point towards [mouse pointer v]
For the first bullet:when gf clicked forever if <(Bullet) = (1)> show go to [machine gun v] point in direction ([direction v] of [Machine Gun v]) move (30) steps repeat until (touching [edge v]?) move (5) steps end if <(Bullet) = (1)> set [Bullet v] to (0) end add [1] to [bullets v] end hide
For the second bullet:when gf clicked forever if <(Bullet) = (2)> show go to [machine gun v] point in direction ([direction v] of [Machine Gun v]) move (30) steps repeat until (touching [edge v]?) move (5) steps end if <(Bullet) = (2)> set [Bullet v] to (0) end add [2] to [bullets v] end hide
And so on for all of the bullets.
Tried & script breaks. I'll upload tomorrow.
Offline
ErnieParke wrote:
Hmmm… That's interesting because it works for me. So how is it breaking?
Here it is, you have to fire a few volleys w/ space key. Then, it won't fire anymore. And I removed the when key space pressed stop all.
Offline
Firedrake969 wrote:
ErnieParke wrote:
Hmmm… That's interesting because it works for me. So how is it breaking?
Here it is, you have to fire a few volleys w/ space key. Then, it won't fire anymore. And I removed the when key space pressed stop all.
Ah, okay. I see the problem. You had made "Bullets" a local list of your plane, so the bullets can't add theirselves back to the list. Fix that and it should work.
Offline
ErnieParke wrote:
Firedrake969 wrote:
ErnieParke wrote:
Hmmm… That's interesting because it works for me. So how is it breaking?
Here it is, you have to fire a few volleys w/ space key. Then, it won't fire anymore. And I removed the when key space pressed stop all.
Ah, okay. I see the problem. You had made "Bullets" a local list of your plane, so the bullets can't add theirselves back to the list. Fix that and it should work.
Ok.
Offline