mardi 24 novembre 2015

how to put timer in if condition

first thing this is not my code i just edit to make new things this is the code i edited, i want my rocket to drop down and stay for maybe 1 sec until it lunch. i did an animation on rocket to drop for 24frame.

this code makes my rocket drop because of animation but it was moving when it drop.

public class RocketMss extends MovieClip {

    var rocketSpeed:Number;
    var rocketTimer:Timer;
    var timing:Number;

     function RocketMss() {

        timing = 0;
        rocketSpeed = 12;
        addEventListener("enterFrame", enterFrame);

    function enterFrame(e:Event){

        rocketTimer = new Timer(100);
        timing = 1;
        if(timing == 1){
            this.x += rocketSpeed;
            timing = 0;
            if((this.currentFrame == this.totalFrames) && this.x > 640){
                removeEventListener("enterFrame", enterFrame);


thank you of your answer.

Aucun commentaire:

Enregistrer un commentaire