-
-
Save drhayes/ef775a97aecaa5549404 to your computer and use it in GitHub Desktop.
Fixed Level1.js for ekeimaja
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
[~/Downloads/Labyrinth] ➔ diff Level1.old.js src/Level1.js | |
12,14d11 | |
< BasicGame.Game.prototype = Object.create(Phaser.State.prototype); | |
< BasicGame.Game.prototype.constructor = BasicGame.Game; | |
< | |
23a21,24 | |
> BasicGame.Game.prototype = Object.create(Phaser.State.prototype); | |
> BasicGame.Game.prototype.constructor = BasicGame.Game; | |
> | |
> | |
28,29c29 | |
< debugger; | |
< this.game.load.tileset('tileset', '/assets/tileset.png', 40, 40); | |
--- | |
> this.game.load.image('tileset', '/assets/tileset.png', 40, 40); | |
36,38c36,41 | |
< this.tileset = this.game.add.tileset('tileset'); | |
< this.tileset.setCollisionRange(0, tileset.total-1, true, true, true, true); | |
< this.layer = this.game.add.tilemapLayer(0, 0, 640, 480, this.tileset, map, 0); | |
--- | |
> this.tileset = this.map.addTilesetImage('tileset'); | |
> this.layer = this.map.createLayer(0, 640, 480); | |
> // this.layer = this.game.add.tilemapLayer(0, 0, 640, 480, this.tileset, this.map, 0); | |
> // this.tileset = this.game.add.tileset('tileset'); | |
> this.map.setCollisionBetween(0, this.tileset.total-1, true, this.layer, true); | |
> |
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
/* global Phaser, tileset */ | |
BasicGame = { | |
}; | |
BasicGame.Game = function (game) { | |
Phaser.State.call(this); | |
this.map = null; | |
this.tileset = null; | |
this.layer = null; | |
var cursors; | |
var player; | |
}; | |
BasicGame.Game.prototype = Object.create(Phaser.State.prototype); | |
BasicGame.Game.prototype.constructor = BasicGame.Game; | |
BasicGame.Game.prototype.preload = function() { | |
this.game.load.tilemap('kentta', '/assets/kentta.csv', null, Phaser.Tilemap.CSV); | |
this.game.load.image('tileset', '/assets/tileset.png', 40, 40); | |
}, | |
BasicGame.Game.prototype.create = function() { | |
this.map = this.game.add.tilemap('kentta', 40, 40); | |
this.tileset = this.map.addTilesetImage('tileset'); | |
this.layer = this.map.createLayer(0, 640, 480); | |
// this.layer = this.game.add.tilemapLayer(0, 0, 640, 480, this.tileset, this.map, 0); | |
// this.tileset = this.game.add.tileset('tileset'); | |
this.map.setCollisionBetween(0, this.tileset.total-1, true, this.layer, true); | |
this.cursors = this.game.input.keyboard.createCursorKeys(); | |
// this.physics.startSystem(Phaser.Physics.ARCADE); | |
// this.cursors = this.game.input.keyboard.createCursorKeys(); | |
// this.spacekey = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); | |
player = this.game.add.sprite(40, 40, 'player', 1); | |
}, | |
BasicGame.Game.prototype.update = function() { | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment