Last active
June 20, 2020 19:16
-
-
Save zeroeth/8889619 to your computer and use it in GitHub Desktop.
tmx starter game
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
| <html> | |
| <head> | |
| <script src='http://cdn.html5quintus.com/v0.2.0/quintus-all.js'></script> | |
| <style> | |
| canvas { background-color: #5e81a2; } | |
| </style> | |
| </head> | |
| <body> | |
| <script> | |
| // This game uses spritesheet.png from: | |
| // http://opengameart.org/content/platform-tileset-nature | |
| var Q = Quintus() | |
| .include("Sprites, Scenes, Anim, Input, 2D, Touch, UI, TMX") | |
| .setup({maximize: true}) | |
| .controls() | |
| .touch(); | |
| // Give us a player from the same tilesheet | |
| Q.Sprite.extend("Player", | |
| { | |
| init: function(properties) | |
| { | |
| // Same name as in the tiled editor | |
| properties.sheet = "Tiles_32x32"; | |
| // Square in the tile set | |
| properties.frame = 51; | |
| this._super(properties); | |
| this.add("2d"); | |
| this.add("platformerControls"); | |
| } | |
| }); | |
| // Load TMX File as a scene | |
| Q.scene("level1", function(stage) | |
| { | |
| Q.stageTMX("level1data.tmx", stage); | |
| var player = Q("Player").first(); | |
| }); | |
| // Load assets and launch the first scene to start the game | |
| // | |
| Q.loadTMX("level1data.tmx" , function() | |
| { | |
| Q.stageScene("level1"); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not working