This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-08-26 18:07:31

kwickgamer
Scratcher
Registered: 2010-07-13
Posts: 42

progectiles?

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.


Kwickgamer Classic Collection! What is it? find out here!

Offline

 

#2 2010-08-26 18:24:33

coppearlix
Scratcher
Registered: 2010-01-31
Posts: 500+

Re: progectiles?

You could make the bullets part of your character's sprite, and make them a certain color.<if><touching color[ purple<hide>


The Gobo has transformed--into the Gobony!
It's ALIIIIVE!

Offline

 

#3 2010-08-26 18:29:14

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: progectiles?

I don't know if it's possible...  hmm


Hai.

Offline

 

#4 2010-08-26 18:36:17

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: progectiles?

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)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#5 2010-08-26 19:58:42

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: progectiles?

Jwosty's solution is really the only way to do it without a bunch of sprites, but 10 projectiles at once might make it lag.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#6 2010-08-26 20:43:02

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: progectiles?

Harakou wrote:

Jwosty's solution is really the only way to do it without a bunch of sprites, but 10 projectiles at once might make it lag.

big_smile


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#7 2010-08-26 22:08:45

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: progectiles?

The only problem with it is that you then have to have the scrolling sprites stamp instead of show.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#8 2010-08-26 23:53:21

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: progectiles?

use multiple costumes in one sprite then switch through them
the 1st costume has one bullet, the next has 2, etc


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#9 2010-08-27 09:33:07

coppearlix
Scratcher
Registered: 2010-01-31
Posts: 500+

Re: progectiles?

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.


The Gobo has transformed--into the Gobony!
It's ALIIIIVE!

Offline

 

#10 2010-08-27 10:22:05

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: progectiles?

Locomule wrote:

use multiple costumes in one sprite then switch through them
the 1st costume has one bullet, the next has 2, etc

But then the bullets would stay at a set distance from the player...  hmm


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#11 2010-08-27 11:42:16

kwickgamer
Scratcher
Registered: 2010-07-13
Posts: 42

Re: progectiles?

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?


Kwickgamer Classic Collection! What is it? find out here!

Offline

 

#12 2010-08-28 13:16:18

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: progectiles?

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.


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#13 2010-08-28 13:32:25

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: progectiles?

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.  wink


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#14 2010-08-28 13:33:40

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: progectiles?

Locomule wrote:

Sometimes, people have all kinds of ideas but haven't even tried scripting them yet.

*cough, cough*  big_smile


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#15 2010-08-28 13:45:05

kwickgamer
Scratcher
Registered: 2010-07-13
Posts: 42

Re: progectiles?

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


Kwickgamer Classic Collection! What is it? find out here!

Offline

 

#16 2010-08-28 18:15:38

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: progectiles?

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.


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#17 2010-08-29 05:31:51

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: progectiles?

Jwosty wrote:

Locomule wrote:

Sometimes, people have all kinds of ideas but haven't even tried scripting them yet.

*cough, cough*  big_smile

I have used your method before.
I will try to find the project as an example or make another.

Offline

 

#18 2010-08-29 05:45:42

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: progectiles?

http://scratch.mit.edu/projects/colorfusion/1269769

Like this?

Offline

 

#19 2010-08-29 09:22:12

kwickgamer
Scratcher
Registered: 2010-07-13
Posts: 42

Re: progectiles?

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.


Kwickgamer Classic Collection! What is it? find out here!

Offline

 

Board footer