I want to make a sidescrolling shooter, I need to know how to make at least ten bullets on the screen at once without having to make ten or twenty objects.
Offline
You could make the bullets part of your character's sprite, and make them a certain color.<if><touching color[ purple<hide>
Offline
You could use stamping. It would work so that when each time the player fires a bullet, the bullet sprite will add an X/Y position to two list called something like "X positions" and "Y positions". Then (in a separate script), the bullet would clear, stamp, go to each xy position, and then change each item of the x position list by one.
Then finally, in another, separate script, the bullet would sense if an xy position is "out of bounds", and then delete that item and it's corresponding buddy on the other list.
Last edited by Jwosty (2010-08-26 18:36:24)
Offline
The only problem with it is that you then have to have the scrolling sprites stamp instead of show.
Offline
Locomule wrote:
use multiple costumes in one sprite then switch through them
the 1st costume has one bullet, the next has 2, etc
That's similar to what I meant, except in my idea there is only one bullet at a time.
Offline
I knew about the costume thing, but I don't think it will work, thanks anyways, and jwosty, I don't follow, could you give me an example?
Offline
If it wouldn't work, I wouldn't suggest it. It would, however, be far more work than just using 10 projectiles.
Often times, the best answer lies in doing things differently than you thought you wanted to at first. The common problem in this forum is that without having an uploaded project to work with, any answers you get will be mostly guess work. Sometimes, people have all kinds of ideas but haven't even tried scripting them yet.
To get the BEST help for any project, first try to make it. Upload the incomplete project and then make a link to it in your forum post. Include specific information... 1) I want it to do this and 2) but it is doing this instead.
Offline
kwickgamer wrote:
I knew about the costume thing, but I don't think it will work, thanks anyways, and jwosty, I don't follow, could you give me an example?
Yea, sure! I can't do that right now (because I won't have access to a computer with Scratch until sometime tonight), though.
Offline
Jwosty wrote:
Yea, sure! I can't do that right now (because I won't have access to a computer with Scratch until sometime tonight), though.
K, and btw, I have tried scripting multiple projectiles, and it's hard! Unless i wanted them to all fire at once, And i don't. =P
Offline
kwickgamer wrote:
Jwosty wrote:
Yea, sure! I can't do that right now (because I won't have access to a computer with Scratch until sometime tonight), though.
K, and btw, I have tried scripting multiple projectiles, and it's hard! Unless i wanted them to all fire at once, And i don't. =P
You can use variables!
The variable would change each time the bullet is fired, and it would loop back when it reaches the maxamum amount of bullets. See, each bullet sprited would be queued when space (or any other key) is pressed and the variable is equal to whatever number you want it to. Then the variable would be changed by one.
Ex:
The first bullet would fire when space is pressed and the variable (lets say... bullet count) equals 1, then it changes it by 1.
The second would fire when space pressed and bullet count = 2, then it changes it by 1.
And the 3rd would fire when space is pressed and bullet count = 3, and it sets it back to 1.
Offline
Jwosty wrote:
Locomule wrote:
Sometimes, people have all kinds of ideas but haven't even tried scripting them yet.
*cough, cough*
![]()
I have used your method before.
I will try to find the project as an example or make another.
Offline
http://scratch.mit.edu/projects/colorfusion/1269769
Like this?
Offline
James wrote:
kwickgamer wrote:
Jwosty wrote:
Yea, sure! I can't do that right now (because I won't have access to a computer with Scratch until sometime tonight), though.
K, and btw, I have tried scripting multiple projectiles, and it's hard! Unless i wanted them to all fire at once, And i don't. =P
You can use variables!
The variable would change each time the bullet is fired, and it would loop back when it reaches the maxamum amount of bullets. See, each bullet sprited would be queued when space (or any other key) is pressed and the variable is equal to whatever number you want it to. Then the variable would be changed by one.
Ex:
The first bullet would fire when space is pressed and the variable (lets say... bullet count) equals 1, then it changes it by 1.
The second would fire when space pressed and bullet count = 2, then it changes it by 1.
And the 3rd would fire when space is pressed and bullet count = 3, and it sets it back to 1.
I used that method on another program, but is it easy on scratch? it was a real pain on that one.
colourfusion, yes, thats what i meant.
Offline