我試圖讓科羅納一個遊戲,如果我點擊並按住屏幕上的輪將旋轉,但只有當我不斷點擊屏幕旋轉如何我改變這一點,以便爲只要我的手指按在屏幕上,輪子會旋轉?這裏是我的代碼:科羅娜SDK觸摸階段 - 觸摸並保持
local physics = require "physics"
physics.start()
--Variables
--[bike = display.newImage("bike.png")
--bike.x = 70
--bike.y = 290
--physics.addBody(bike, {friction = 0.3, bounce = 0.2})
wheel1 = display.newImage("wheel.png")
wheel1.x = 480/2
wheel1.y = 320/2
wheel2 = display.newImage("wheel.png")
wheel2.x = 480/2 + 50
wheel2.y = 320/2 - 50
driveBtn = display.newImage("drive.png")
local function driveFunction(event)
wheel1.rotation = wheel1.rotation + 3
wheel2.rotation = wheel2.rotation + 3
end
Runtime:addEventListener("touch", driveFunction)
[ot]你好,歡迎來到SO。我希望我能夠在14歲時爲corona SDK編碼,所以,我猜這很不錯! – Saturnix 2013-04-23 01:15:03