Although I can do most of the stuff in this game quite easily the problem I'm stuck at is I want to make enemies randomly drop power ups. (if any of you have ever played the arcade game Raiden you'll understand quite easy) I dont know if I need seperate sprites for each power up or what all I exactly need to do. Also if you could tell me how to, when you pick up the power up change the attack type. (My ship fires lasers whenever I press space, I would like to be able to change it to say, lightning or globs of acid)
Also this game is for a tournament type deal in my city, I want to be able to place high and hopefully either win the labtop(which I doubt). Or some other prize so any advice or Ideas would be super helpful.
Thx for the help if you can provide any! ^^.
Offline
This sounds ambitious! If you had what you've done so far I could probably help more. The powerups will need to do three things: appear where an enemy drops them, wait for the player to collect them, and then change something when they are collected. I'm going to try to show this as best I can without actually creating a project. If you're confused about anything in the code below, just ask. Every Scratcher seems to have his or her own way of writing out code.
First we'll need these variables and lists:
---Variables--- global powerupCount global dropX global dropY global dropNumber global poweupsLock #(set this to "false" before the game starts.) powerup's myPowerupNumber powerup's displayed powerup's myValue enemy's i ---Lists--- global powerupsInAction enemy's myFoundPowerupsList
Now on the powerup sprites (you'll probably want four to ten depending on how often they'll be dropped) add these scripts:
# First we need to give each powerup a unique number. You'll need to [broadcast countPowerups and wait] before the game starts.
when I receive (countPowerups){
change powerupCount by 1
set myPowerupNumber to powerupCount
add ["false"] to [powerupsInAction];
}
# An enemy will set the values of dropX, dropY, and dropNumber before it broadcasts dropPowerup.
when I receive (dropPowerup){
#If the powerup number requested is this powerup's number:
if(dropNumber = myPowerupNumber){
set item (myPowerupNumber) of [powerupsInAction] to ["true"]
hide;
go to (dropX,dropY);
show;
repeat until(touching(player)){
#Do something while waiting to be collected. Maybe spin menacingly or glow or something.
}
#I've been collected. Maybe shrink or fade out here.
hide;
set item (myPowerupNumber) of [powerupsInAction] to ["false"]
#at this point, we probably want to power something up. a few things you might want to do:
#set playerGunType to "acidBlobs"
#change gunPower by 1
#set shield to 100
}
}Of course, this won't really do anything unless we broadcast dropPowerup, so we can have an enemy do that with code like this:
#Place this bit of code wherever you want the enemy to drop the powerup:
#Wait until we're sure no other enemy is trying to do the same thing we are:
wait until (powerupsLock = "false")
set i to 0;
set powerupsLock to "true";
#Look through the global list where powerups say whether they're onscreen or not and try to find one that isn't. If we find one, add it to my private list, myFoundPowerupsList.
delete all of [myFoundPowerupsList]
repeat (powerupCount){
change i by 1;
if(item (i) of [powerupsInAction] = "false"){
add (i) to [myFoundPowerupsList];
}
}
if(length of [myFoundPowerupsList] > 0){
#Oh good, we've found at least one powerup that isn't in action at the moment.
set dropNumber to (pick random between 1 and (length of [myFoundPowerupsList]));
set dropX to x position;
set dropY to y position;
broadcast (dropPowerup);
}
powerupsLock="false"I realize that this is probably not the simplest way to do it, but it a) ensures that enemies don't drop powerups that are already on stage and b) that they drop random powerups. If you have any trouble translating my typing to blocks or need more help, leave another post.
Scratch on!

Offline