View Full Version : powerups how to make them
pyroki
July 6th, 2005, 07:15 PM
k i hav been trying to make powerups for a while and been havn trouble but not with grabing them just making them appear and then fall and how to get them to fal after a period of time any1 no how
Skribble
July 6th, 2005, 09:10 PM
depends what kinda game you are making. Bu I guess for a side view game is relatively the same....
onLoad = function () {
timer = 50;
// set a timer
pNum = 0;
// set a depth variable
};
onEnterFrame = function () {
timer--;
// decrease the timer
if (timer<=0) {
// if the timer equals 0
newPowerUp = _root.attachMovie("powerup", "newPowerUp"+pNum, pNum++);
// attach your power up
_root.newPowerUp.onEnterFrame = function() {
// the new powerups enterFrame function
if (!this.hitTest(_root.ground)) {
// if your powerup isnt touching the ground
this._y += 5;
// make it decrease by 5
}
};
timer = 100; //reset the timer
}
};
That should give you an idea.
pyroki
July 6th, 2005, 11:29 PM
k ill try it
pyroki
July 6th, 2005, 11:30 PM
o and btw it it is a platform game or sidescroller wutever u want to kall it
pyroki
July 7th, 2005, 01:46 AM
hmmm it didn't really work but u did giv me a better idea of how to do it thx i still need help maybe i put the script in the wrong place? :book:
grinch
July 7th, 2005, 01:59 AM
How about you learn how to code before you start taking complex code for yourself
pyroki
July 7th, 2005, 02:04 AM
hey i do know code its just not for games its for web design and graphics
Skribble
July 7th, 2005, 02:46 AM
I just tried it, it should work.
Make sure you have the linkage and instance names spelt right.
pyroki
July 7th, 2005, 12:34 PM
yea all of them are the right names
pyroki
July 7th, 2005, 01:33 PM
ok looking good except whenever i play it the powerup is already coming down for some reason wut shud i do i tried adjusting the variables but no luck
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.