Created
December 4, 2011 22:07
-
-
Save giginet/1431443 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
| enchant() | |
| class SampleGame extends Game | |
| constructor : -> | |
| super 320, 320 | |
| @fps = 30 | |
| SampleGame.game = @ | |
| @preload "miku.gif" | |
| @onload = -> | |
| @rootScene.addChild new Player(100, 100) | |
| @start() | |
| class Player extends Sprite | |
| constructor: (x, y) -> | |
| super 44, 32 | |
| @x = x | |
| @y = y | |
| game = SampleGame.game | |
| @image = game.assets['miku.gif'] | |
| @addEventListener 'enterframe', -> | |
| if game.input.up | |
| @y -= 5 | |
| else if game.input.down | |
| @y += 5 | |
| if game.input.left | |
| @x -= 5 | |
| else if game.input.right | |
| @x += 5 | |
| window.onload = -> | |
| new SampleGame() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment