【发布时间】:2011-08-14 08:09:05
【问题描述】:
我正在开发一个可以发射多发子弹的功能:
local function shootBullets ( event )
local bullet = display.newImageRect("images/Bullet.png", 12, 12) --Create the bullet image
physics.addBody(bullet, "kinematic", {bounce = 0}) --Allow physics stuff to work on it
bullets:insert( bullet ) --Add it to a global group called "bullets"
bullet:setLinearVelocity(20, 40) --Give it a velocity
end
我用这个计时器来调用它:
timer.performWithDelay(10, shootBullets)
它会移动一颗子弹,但不会制造新子弹。每次调用shootBullets ( event ) 时,如何让它产生新的子弹?我对 Lua 不太熟悉,如果我做的事情明显错误,或者我没有提供足够的信息(如果您需要更多信息,请询问),我很抱歉。
【问题讨论】: