Created
January 5, 2013 18:25
-
-
Save omidahourai/4462949 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Hud.lua | |
scene:addEventListener('onEnemyKill', Hud) | |
function Hud:onEnemyKill(event) | |
local points = self.points + 20 | |
self.points = points | |
self:dispatchEvent({name='onEnemyKill', points=points}) --dispatch to Hud scope | |
end | |
--Score.lua | |
Hud:addEventListener('onEnemyKill', Score) --listen on Hud scope | |
function Score:onEnemyKill(event) | |
self.text = event.points | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment