简体   繁体   中英

Issues between switching two sprites

I'm new to corona sdk and I'm developing a game. My game has big characters and big sprite sheets as well. when testing a game I found that not every time but sometimes when I switch between two sprites it stuck the character and some other conditions related to the character.

following is the code...

    if(isSwapping == false and canSwipeBln == true) then
        isSwapping = true;

        canDuckBln = false;
        canJumpBln = false;
        canSwipeBln = false;

        tempSwapBln = touchBln;
        touchBln = false;

        print("current frame     == " .. hero.currentFrame);
        print("current sequence  == " .. hero.sequence); 

        if(hero.sequence ~= "goodNinjaSwipe") then
            hero:prepare("goodNinjaSwipe");
        end
        hero:play();

        print("current frame     == " .. hero.currentFrame);
        print("current sequence  == " .. hero.sequence); 
   end

When I try to debug it, it shows the name of the switched(goodNinjaSwipe) sprite but the number of frames of the old sprite(goodNinjaWalk). Is this the technical issue? I don't understand

Thanks in advance...

You are very probably mixing he two sprite APIs...

"prepare" was used in the old API, this API is now deprecated...

the new API uses "setSequence".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM