Problem with timers-

[lua]function spawn_bomb()
local bomb = display.newImageRect(“green.png”, 32, 32)
bomb:setReferencePoint(display.CenterReferencePoint);
bomb.x = mRand(50, _W-50); bomb.y = mRand(50, _H -50);
function bomb:touch(event)
self:removeSelf();
score = score + 1;
txt_score.text = "Score: " … score;
end
local tmr_change_col = timer.performWithDelay(1500, change_col, 3);
bomb:addEventListener(“touch”, bomb);
end
tmr_new_bomb = timer.performWithDelay(5000, spawn_bomb, -1);[/lua]

So I want to spawn bombs every five seconds and I want them to disappear when the player “touches” them. so far so good. The bombs are green from the start and when I create a new bomb I want to start a timer for say 3 secs and when that timer expires, I want to change the image to a yellow one. I then want to repeat that process and change the bomb to red. then repeat again and after three seconds again without a “touch” it will be game over. How do I code this? Im a bit lost here. [import]uid: 37930 topic_id: 7191 reply_id: 307191[/import]

i would do a 3 second timer repeating 3 times or whatever, then check the value of [lua]event.count[/lua] to determine what state it should change to

to change your actual graphic you will need to remove the first one and add a new one (assigning it to the same variable or display group) [import]uid: 6645 topic_id: 7191 reply_id: 25302[/import]