Created
June 4, 2012 05:55
-
-
Save giginet/2866577 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 Shooting extends Game | |
| config : { | |
| WIDTH : 640, | |
| HEIGHT : 480, | |
| FPS : 30 | |
| } | |
| constructor : -> | |
| super @config.WIDTH, @config.HEIGHT | |
| @fps = @config.FPS | |
| @keybind(90, 'a') | |
| @keybind(88, 'b') | |
| Shooting.game = @ | |
| Shooting.config = @config | |
| root = new MainScene() | |
| root.setup() | |
| @start() | |
| window.onload = -> | |
| new Shooting() | |
| class MainScene extends Scene3D | |
| setup : -> | |
| @setDirectionalLight = new DirectionalLight() | |
| camera = @getCamera() | |
| camera.y = 20 | |
| camera.z = 80 | |
| camera.centerY = 10 | |
| @ball = new Cube() | |
| @ball.mesh.texture = new Texture "resources/images/gigicat.png" | |
| @ball.z = -10 | |
| @ball.rotX = 0 | |
| @ball.addEventListener 'enterframe', (e) -> | |
| @rotX += 0.01 | |
| @rotation = [ | |
| Math.cos(@rotX), 0, -Math.sin(@rotX), 0, | |
| 0, 1, 0, 0, | |
| Math.sin(@rotX), 0, Math.cos(@rotX), 0, | |
| 0, 0, 0, 1 | |
| ] | |
| @addChild @ball |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment