Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Power Ups; how to make power ups
Topic Started: Apr 12 2005, 02:49 AM (336 Views)
clayt
Member Avatar
I'm not crazy... ask my toaster!
howdy, havnt been on latley, been in america and busy, but im sooo stuck on making power ups in flash, ive searched and searched for tuts on how to make them, ive even emailed the creator of Powerfox, but havnt got a reply yet, so i thought id try here, please Vector if your here, please help, if you know any really good tuts for power ups, your could explain how to make them in an easy form, i would be sp greatfull.

Thanks.

Clayt
Offline Profile Quote Post Goto Top
 
Mr. Jiggmin
Member Avatar
made of tulips
It would depend on how you're making your game. Here's my best guess as to how the powerfox guy did it:
1) in you're character movie clip, put the various states of your character. (e.g. your character when he has the uber buttocks power up or the super gun-o-death power up)

2)give the objects the character picks up some kinda code like:
//if your character is touching the powerup then do stuff
if(_root.yourCharacter.hitTest(this)){
//tells the character to go to the frame where it has the appropriate power up
_root.yourCharacter.gotoAndPlay(whatEverFrame);
/*this waits 10 seconds (10000 milliseconds) and then calls the function reset
of course you have to make a reset function somewhere. It'll probably just set the
characters frame back to 1*/
setInterval(reset, 10000);
//remove the power up from the stage
this.unload();
}

Well, I was planning on having more steps but everything kinda got jammed into step two.:rolleyes: Hope that helps. :lol:
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
Hi guys... sorry I haven't been around lately... muchos bad things happening...

Um, to make powerups it really depends on what you want. But a good way to do them is:

-Have a variable
-Change that variable when you get the powerup
-Set a timer to change it back / run a condition to check if it should 'expire'

So for example, if I wanted to have a weapon powerup I would start with a variable like vWeapon = 0, or vWeapon = "gun" or whatever the default value would be.
Then I would run a condition every frame or something to test to see if they collected the powerup.

When the character collects the powerup you would change the variable, eg vWeapon = 1 or vWeapon = "super-cannon", and you would set a Timer, eg
vWepTimer = setInterval(fReset, 10000);
Which, after 10 seconds, would call fReset.
then you would have to write fReset, which would go something like
function fReset() {
clearInterval(vWepTimer);
vWeapon = 0; //or vWeapon = "gun";
}

and that would run your weapon powerup thingey.

Then the only part you'd have to do is actually make it do/mean something. All this is is variable managment, what you'd have to do is connect the variable to something, so for example each frame it might check to see what vWeapon is and have the right movieclip displayed accordingly each time. :)

Post more q's if you have any.
Offline Profile Quote Post Goto Top
 
clayt
Member Avatar
I'm not crazy... ask my toaster!
thank you so much Mr. Jiggmin, and Vector, both were very good, but i went for the easy approach and used Mr. Jiggmin way, thanks for both of your help.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Actionscript · Next Topic »
Add Reply