Created
January 21, 2012 01:51
-
-
Save hughfdjackson/1650729 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var purr = require('../utils/purr') | |
| var scene = purr.create('scene') | |
| scene.init = function(images){ | |
| var canvas = scene.director.canvas | |
| // --- Scene Data --- // | |
| var data = { | |
| background : { | |
| backgroundImage: images.background | |
| , location: [0, 0] | |
| } | |
| , play_button : { | |
| backgroundImage: images.play_button | |
| , location: [(canvas.width - images.play_button.width)/2, 200] | |
| } | |
| , title : { | |
| backgroundImage: images.title | |
| , location: [(canvas.width - images.title.width)/2, 75] | |
| } | |
| } | |
| // --- Scene Behavior --- // | |
| var background = purr.create('actor', data.background) | |
| , play_button = purr.create('actor', data.play_button) | |
| , title = purr.create('actor', data.title) | |
| play_button.mouseClick = function(){ | |
| scene.director.switchToNextScene(1000, true, true) | |
| } | |
| var container = purr.create('actorContainer', { isGlobalAlpha: true, bounds: [0, 0, canvas.width, canvas.height] }) | |
| purr.anim(container, 'alpha', { values: [0, 1], frameTime: [0, 1000]}) | |
| purr.add(container, [background, play_button, title]) | |
| purr.add(scene, container) | |
| } | |
| module.exports = scene |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment