如何在Corona中同时移动和旋转图像?

我正在尝试在游戏中投掷飞镖。 我可以使用以下代码移动飞镖:

bulletTransition[bulletCounter] = transition.to(bullets[bulletCounter], {x=-250, time=2000, onComplete=function(self)
        if(self~=nil) then
            display.remove(self)
        end
        end})

我知道可以使用以下代码旋转对象:

transition.to( bullets[bulletCounter], { rotation = bullets[bulletCounter].rotation-360, time=2000, onComplete=spinImage } )

但我该如何同时实现平移和旋转?

点赞
用户1979583
用户1979583

你可以在一个单独的转换中同时调用两个函数。就像这样:

local rect = display.newRect(300,100,50,50) -- 创建对象

transition.to(rect, {x=-250, rotation = rect.rotation-360,time=2000,} ) -- 调用转换
2015-05-05 19:38:45