dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Electricution Game

  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    40

    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

  2. #2
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    do i make sence
    no
    New sig soon

  3. #3
    Member
    Join Date
    Jun 2006
    Posts
    40

    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??

  4. #4
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    i do know, better to do the whole thing in actionscript, i'll get back to you with the solution
    New sig soon

  5. #5
    Member
    Join Date
    Jun 2006
    Posts
    40

    thanks

    that you extremely much. that is a huge help!!!!

  6. #6
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    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
    New sig soon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center