-
Electricution Game
i am attemting at the moment to create an Electricution minigame. i am trying to make a bar that gets smaller continuesly. this is motion tweened. once the bar is empty you lose. i have added a on space previous frame so that to win you have press space as many times as possible and not alloy the bar to empty. the problem is that with the actions i gave it when you click the space bar it goes to the previous frame of the motion tween but the bar stops moving. i want the bar to continue getting smaller but still alloy it to go back up on a continues space push.
do i make sence
Thanks
Sterockicy
-
Senior Member
-
ok ill make it easier
there is a bar. it is motion tweened to get smaller over 80 frames. is there a way to make it so that on a space push the bar will get slightly bigger. so to win the level you must press the space really fast to stop the bar from getting too small.
is that easier to understand??
-
Senior Member
i do know, better to do the whole thing in actionscript, i'll get back to you with the solution
-
thanks
that you extremely much. that is a huge help!!!!
-
Senior Member
make a movieClip with the instance of "bar", this will be the clip that gets narrower.
then add this script to the frame.
Code:
var down:Boolean = false;
var kl:Object = new Object();
bar._xscale = 50;
bar.onEnterFrame = function() {
this._xscale -= 2;
if (this._xscale>=100) {
// put win scrip here
} else if (this._xscale<=0) {
// put loose scrip here
}
};
kl.onKeyDown = function() {
if (!down && Key.isDown(Key.SPACE)) {
bar._xscale += 4;
down = true;
}
};
kl.onKeyUp = function() {
down = false;
};
Key.addListener(kl);
HTH,
zlatan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|