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

#1 2010-09-21 22:36:58

tchan5158
New Scratcher
Registered: 2010-09-19
Posts: 25

How To Plan For 100+ Sprite Attacks?

Hello  big_smile

I'm making a vertical scrolling shoot em up game, and this type of game usually requires waves of enemies totally 100 or more per stage.  Is there a nice efficient way to keep track/program/control all the variables that each enemy ship have?  (such as Health, Armor, Gun Strength, Attack Pattern, Damaged States...etc)

Because so far, I made an enemy ship and it has sooooo much code, and once I duplicated it, I had to manually change all the variables, like renaming Ship1HP to Ship2HP, and I know I will go crazy if I need to do that 100 or more times for each ship!  O_O;;

-Tommy

Offline

 

#2 2010-09-21 22:39:48

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

Re: How To Plan For 100+ Sprite Attacks?

Here's what you do:  When you are making an enemy type, make only one enemy.  As you are making the variables, that "type variable name" box will come up.  Check the "for this sprite only" box, and then it has individual variables.  When you duplicate it, this affect is also duplicated, so you don't have to worry about making more variables.


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

Offline

 

#3 2010-09-21 22:42:46

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: How To Plan For 100+ Sprite Attacks?

AtomicBawm3's method will work, I'm just posting here to warn you about making a game with that many sprites. The more sprites you add the slower the program will run so I advise making no more than 75 sprites total.


Good luck  smile


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#4 2010-09-21 23:46:27

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

Re: How To Plan For 100+ Sprite Attacks?

Yep, AtomicBawm3's method will work fine, but I think the lag will become unbearable. I would recommend keeping the number of enemies under 50, or finding another method. Just so you know, if all 100 aren't on stage at once, then you don't need 100 sprites. For example, you can have just 10 sprites on stage at once, and only need 10 sprites.


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

Offline

 

Board footer