我正在尝试在 Corona 中制作一个游戏,如果我点击并按住屏幕,滚轮会旋转,但只有当我继续点击屏幕时它才会旋转我如何更改它,这样只要我的手指按下屏幕,轮子会转动吗?这是我的代码:
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)