Skip to content

Instantly share code, notes, and snippets.

@figengungor
Created June 9, 2013 13:04
Show Gist options
  • Select an option

  • Save figengungor/5743438 to your computer and use it in GitHub Desktop.

Select an option

Save figengungor/5743438 to your computer and use it in GitHub Desktop.
EnterFrame Event in Corona
--Disco App =)
--Create a rectangular object that covers the entire screen
disco = display.newRect(0,0, display.contentWidth, display.contentHeight)
--Play Disco music
media.playSound("whatislove.wav")
local function changeColor()
--Changes the color of "disco" rectangular object randomly in every frame
disco:setFillColor(math.random(0,255),math.random(0,255), math.random(0,255))
end
--EnterFrame listener calls "changeColor" function every frame
Runtime:addEventListener("enterFrame", changeColor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment