We need to add the layout of the stars in the game and have them moving to add a little effect that they're active. A collision event will need to be applied so they are removed when the panda collides with them.
Create a new function called
createStars()
and lay out thestar
objects in afor
loop. Add in the"collision"
event that will be called byonStarCollision()
to remove the stars when they are hit by the panda. Rotate the stars forwards and backwards at 10 seconds and 1080 and -1080 degrees each. This will allow the stars to rotate three full intervals backwards and forwards. Create the walls for the left and right side of the screen.local createStars = function() local numOfRows = 4 local numOfColumns = 12 local starPlacement = {x = (display.contentWidth * 0.5) - (starWidth * numOfColumns ) / 2 + 10, y = 50} for row = 0, numOfRows - 1 do for column = 0, numOfColumns - 1 do -- Create a star local star = display...