簡體   English   中英

如何在電暈SDK中使某些東西朝觸摸方向旋轉?

[英]How to make something rotate towards touch in corona sdk?

我一直堅持這一點,但沒有找到任何幫助。 您能舉例說明解決方案嗎? 謝謝。

這是一個簡單的例子。 不確定如何旋轉和過渡,但是它具有所需的基礎知識。

local star = display.newLine( 200, 90, 227, 165 )
star.anchorX = 0.2257
star.anchorY = 0.5

star.x = display.contentCenterX 
star.y = display.contentCenterY
local function listener1(  )
  -- body
end

local function rotate(event)
  timer.performWithDelay(1000, function() star.rotation = star.rotation + 6; end, 0)
transition.to( star, { time=15000, alpha=1, x=(event.x), y=(event.y), onComplete=listener1 } )

end

Runtime:addEventListener("touch", rotate)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM