Hello everyone, I have an interesting bug. The game is setup with hands at the bottom. When the screen is touched the hands throw a Chinese star at a target moving along the x-axis at top of the screen. As the player progresses the targets begin to move faster. The old targets that were already on the screen stay at their initial speed. They begin to overlap. When this occurs if the star hits two targets at the same time it causes a bug freezes the game. Now obviously the targets and stars are removed upon collision. Here’s the code.
[lua] local function spawnTarget1( event )
target1 = display.newImage(“target_final.png”)
target1.name = “target1”
physics.addBody(target1, “kinematic”, {density=0.0, friction=0.0, bounce=0.0, radius= 15})
target1:setReferencePoint(display.CenterReferencePoint)
target1.y = 65
if gamePhase == “Phase one” then
transition.to(target1, {time = 30000, x = display.contentWidth + 200})
elseif gamePhase == “Phase three” then
transition.to(target1, {time = 10000, x = display.contentWidth + 200})
elseif gamePhase == “Phase four” then
transition.to(target1, {time = 9000, x = display.contentWidth + 200})
elseif gamePhase == “Phase five” then
transition.to(target1, {time = 8000, x = display.contentWidth + 200})
elseif gamePhase == “Phase six” then
transition.to(target1, {time = 7000, x = display.contentWidth + 200})
end
if target1.x > 590 then
table.insert(toRemove2, event.other)
end
mg:insert(target1)
return target1
end
local function onCollision(self, event)
if self.name == “star” and event.other.name == “target1” and gamePhase ~= “Phase over” then
score = score + 1
scoreText.text = score
audio.play(sounds.hit)
table.insert(toRemove, event.other)
table.insert(toRemove2, self)
phaseUpdate()
elseif self.name == “star” and event.other.name == “statue” and gamePhase ~= “Phase over” then
gameEnd()
end
end
[import]uid: 49863 topic_id: 28734 reply_id: 328734[/import]

[import]uid: 52491 topic_id: 28734 reply_id: 116042[/import]