Wait really?
Ok, I am just putting the code here JUST in case if you want to check it out.
But can you give me an example on that if you don’t mind? To make them move towards the center with transition. I have never learnt about that yet.
local composer = require( "composer" ) local scene = composer.newScene() local widget = require("widget") local physics = require("physics") physics.start() physics.setDrawMode("normal") system.setIdleTimer( false ) function scene:create( event ) local BG = display.newImage ("BG.png") local Gem = display.newImageRect ("Gem.png", 50, 50) Gem.x = display.contentCenterX Gem.y = display.contentCenterY local Spear = display.newImageRect ("Spear.png", 15, 50) Spear.x = 100 Spear.y = display.contentCenterY end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local group = display.newGroup() local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). elseif ( phase == "did" ) then ----------------------- local Spears = {} local SpearsTimer local SpearsCounter = 1 local delayTimer local removeListeners end end local field = display.newCircle( 0, 0, 0 ) ; field.alpha = 0.3 field.name = "field" field.x = display.contentCenterX ; field.y = display.contentCenterY physics.addBody( field, "static", { isSensor=true, radius=320 } ) local spawnSpears = function() local Fall = math.random(display.contentWidth \* -0.2, display.contentWidth \* 1.2) Spears[SpearsCounter] = display.newImageRect( "Spear.png", 15, 50 ) Spears[SpearsCounter].x = Fall Spears[SpearsCounter].y = -200 physics.addBody( Spears[SpearsCounter], "dynamic", {bounce = 0} ) --Spears[SpearsCounter].collision = onCollision --Spears[SpearsCounter]:addEventListener( "collision", Spears[SpearsCounter] ) transition.to( Spears[SpearsCounter], { rotation = Spears[SpearsCounter].rotation+720, time=15000, onComplete=spinImage } ) Spears[SpearsCounter].gravityScale = 0.5 sceneGroup:insert(Spears[SpearsCounter]) group:insert(Spears[SpearsCounter]) SpearsCounter = SpearsCounter + 1 end SpearsTimer = timer.performWithDelay( 5000, spawnSpears, -1 ) -- this is a time and 1000 is 1 second and 1000 miliseconds.. it will spawn one circle every one second.. you can change this at your own liking. -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- composer.removeScene("Game1") elseif ( phase == "did" ) then --composer.removeScene("Game1") end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view composer.removeScene("Game") end ------------------------------------------------------------------- -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene