hey guys
i want all the enemies present on the screen to rotate after a collision
enemies are inserted into a table…
- code of enemy spawning virus[enemyCounter] = display.newRect(sceneGroup , 0,0, 50,50) virus[enemyCounter].x = math.random(rod1.x + rod1.width, screenRight - rod1.width) virus[enemyCounter].y = screenTop - virus[enemyCounter].height virus[enemyCounter].name = "enemy" physics.addBody(virus[enemyCounter],"dynamic") virus[enemyCounter].isFixedRotation = false transition.to(virus[enemyCounter], {y = screenBottom - virus[enemyCounter].height \* 0.5, time =enemyTravelSpeed, onComplete = function(self) if self ~= nil then display.remove(self); self = nil ; end end }) -- code of rotating after collision for i = 1, #virus do trans\_enemies = transition.to( virus[enemyCounter], { rotation = virus[enemyCounter].rotation+360, time=1500} ) end
but that rotating code didn’t seem to work
only one or two enemies present on the screen rotates