循环动画在as3中无法正确循环

问题描述 投票:0回答:1

我正在制作一个游戏,你可以躲避天空中的物体,并为其制作动画,我只是在像 234567 234567 这样的帧之间循环,但是当我添加更多帧时,它会像 123456789,10,12,13,14,15 234567 234567有人可以帮忙吗?

function oKeyDown(e:KeyboardEvent):void {
        trace("key being pressed");
        switch(e.keyCode) {
            case Keyboard.LEFT:
                v = -speed;
                player.scaleX = 1;
                running();
                break;
            case Keyboard.RIGHT:
                v = speed;
                player.scaleX = -1;
                running();
                break;
        }
    }
    function running():void {
        trace(String(player.currentFrame));
        if(player.currentFrame < 2 || player.currentFrame > 7) {
            player.gotoAndPlay(2);
        }
    }
    function oKeyUp(e:KeyboardEvent):void {
        trace("key being let go");
        v = 0;
        player.gotoAndStop(1);
        trace(String(player.currentFrame));

https://youtu.be/hAnggbb3yBg

https://www.mediafire.com/file/qibipztp58v9hj1/Dodge_Falling_Objects.fla/file

https://www.mediafire.com/file/zrl47p9xccvgabp/Main.as/file

actionscript-3 flash actionscript
1个回答
0
投票

我认为你的大于和小于的顺序是错误的

© www.soinside.com 2019 - 2024. All rights reserved.