我是 corona sdk 的新手,我正在开发一款游戏。我的游戏也有大角色和大精灵表。在测试游戏时,我发现不是每次,但有时当我在两个精灵之间切换时,它会卡住角色和与角色相关的其他一些条件。
以下是代码...
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
当我尝试调试它时,它显示了切换(好忍者滑动)精灵的名称,但显示了旧精灵(好忍者步行)的帧数。这是技术问题吗?我不明白
提前感谢...
你很可能混合了他两个精灵 API......
"prepare"在旧的API中使用,这个API现在已经不推荐使用...
新的API使用"setSequence"。