Space Shooter help, anyone?

Hi, I’m trying to make a space shooter type game, and I followed a tutorial on flashkit, and I have all that done, but. How do you do powerups? And how can you make the level end? And how can you make a boss? How do you make a powerbar instead of just “Lives” going down when you get hit. If you can anwser any of these questions, I would greatly appreciate it.

Thanks.

I am also doing a FPS type game related to star fox
SCREEN SHOT

Thats an older screen shot, not updated. I will have a few questions on that too…

Aw comeon, nobody knows?

hmmm well i just made one for school :wink: so lemme see if i can answer some of these questions…

Powerups:

i am assuming your laser detection works and you know how to duplicate movie clips… soooo just when you do your if(hitTest, blah) thing… inside the if statement to see if the laser collides with an enemy, make a variable to hold a random number… and if the number is within a certain range, depending on what percent chance you want a powerup to generate, just have it duplicate a powerup movie clip in the same x and y location as the enemy ship, before you remove the enemy movie clip… or else it will have no x and y positions to assign, and within the powerup would probably be the best place to put detection code for the ship and modify whatever stats it will…

Level End:

ok… first determine what you want to make the level end, be it a boss or a death or a certain number of kills, whatever… you gotta have a conditional statement that is checked every enterframe (i am assuming you run this mostly out of 1 frame with code within movie clips) and if you condition is met… the easiest way i found was to say

_root.gotoAndStop(frame);

… “frame” being a frame on the main timeline with whatever you want to be next… so just when your condition is met have it go to a frame on the timeline to whatever is next in your game

Boss:

umm for my boss i did it with the same principals as the game ending or level ending. i had my conditional… which was if the kill count was above 200 (short game i know) it went to the next frame where the boss was. the way i had my layers set up everything stayed the same but in the next frame it just had an extra for the boss. so everything except the boss was extended with the f5 kind of extend… without the keyframe so everything isnt reset, and there is a new key frame with your boss in it… i hope that was clear…

Power Bar:

im assuming you mean like life bar or health bar of some sort… so umm what i did, which was pretty easy, is i made a movie clip with a shape tween that was 100 frames long, and the tween was the color within the box scaling down, so within my ship i had it on every enterframe to access teh movie clip of my health bar and have

_root.lifebar.gotoAndStop(_root.health);

“health” being a variable declared on my main timeline and accessed with root so that way its not local to just the ship, it just makes it easier to access. so anyway on every enter frame, i do the same detection for the ship and if it gets hit by a laser or enemy it changes the variable on the timeline and whatever the life is at (starting at 100 and subtracting when you get it) it will go to the corresponding frame within the life bar movie clip. (side note, when i changed my health variable i did Math.round(health); on the next line, to round it to the nearest whole number to eliminate any decimals in case flash put any in. because if there are decimals it wouldnt go to any frame)

i think thats about all your questions… im still working on my game, but i might post the FLA after im done if anybody wants… if you want to see it as it is its here for download (i know the sound effects suck) but im still getting more… not done yet ;)… and if you play it the circles with the S increase speed and those with H increase health. (boss after 200 kills)

so anyway, EnthesisInferno, if you still have questions ill try to answer them… or if anyone has any easier methods of doing things than i said, fill me in please :smiley:

Wow, thanks.

But you didnt say where I need to do these things, like which movie clip.

all of it can be conditional if statements within your ship movie clip… the powerups can be but it would probably be easier to put the detection code within itself, and you know how to duplicate… i explained the powerups… umm… how urgent is this… if its really urgent i can post my FLA… but it does help a lot if you experiment with code and get stuff to work for yourself… cuz then you know you would be able to do it on your own later if you needed… (take it from me, lol im self taught with actionscript thanks to kirupa.com =) )

you know if you want you can post your fla and i’ll look at it (when i get time… i got a lot of homework) and ill put in some comments where i think code could be stuck in… and put in a little pseudocode… and you can take it from there if thats more what you wanna do…

Edited by me because.

My new problem is my health bar, I have it mostly done, I got the enemy to make it go down when it hits you, but when your at the last hit, it dosent do anything. Any one have any ideas?

My code is

The

_root.shipLife = shipLife=_root.shipLife-20;
if(_root.shipLife <= 0) {_root.gotoAndStop(1265);}

The 1265 is my game over screen.

Thanks in advance

-INFERNO

It should work. You should tell us more.

But can you try just one little thing?

_root.shipLife -= 20;
if (_root.shipLife <=0 )  {
    trace ("you're dead");
    _root.gotoAndStop(1265);
}

pom :cowboy:

No, still didnt work.

It might help that the actions for this is in a frame inside a movie clip.

Well, I know it doesn’t work, but did it trace “I’m dead”?

Yeah, something poped up in the output and it said “You’re dead”

But whats the whole point of it? Why do you know it dosent work?