i am developing a game....one tank on ground and so many object are flying on sky, when i am firing bullet from tank, if bullet collide with object then object are removing and after 100 firing tank are removing self, then Gave over....after Game over i want to remove all objects who are flying on screen(actually cancel all transition and clean screen ) any help:
Code of object who are flying on screen..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | if (rand <= 50) then enytnk = display.newImage("tankbody.png") enytnk.x = 40 enytnk.y = 40 enytnk.name = "enytnk" enytnk.isLive = true physics.addBody(enytnk, { friction = 0, density = 100 }) tr1=transition.to(enytnk, { delay = 50, time = 20000, x = 1024, y = 60, alpha = 1, }) |
you'd have to place all your enytnk's that you spawn inside a table, then clear that table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | local enytnk = {} local i = 0 if (rand <= 50) then i = i + 1 enytnk[i] = display.newImage("tankbody.png") enytnk[i].x = 40 enytnk[i].y = 40 enytnk[i].name = "enytnk" enytnk[i].isLive = true physics.addBody(enytnk[i], { friction = 0, density = 100 }) tr1=transition.to(enytnk[i], { delay = 50, time = 20000, x = 1024, y = 60, alpha = 1, }) |
views:1531 update:2012/1/13 9:04:04