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
constructor(x, y) { | |
... | |
this.isBeingDragged = false; | |
dragger.events.onDragStart.add(this.onDragStart, this); | |
dragger.events.onDragStop.add(this.onDragStop, this); | |
... | |
} | |
onDragStart(){ | |
this.isBeingDragged = 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
class Joystick extends Phaser.Sprite { | |
constructor(x, y) { | |
super(game, 0, 0, 'background'); | |
this.anchor.setTo(0.5, 0.5); | |
/* Pin indicator - what players think they drag */ | |
this.pin = game.add.sprite(0, 0, pin); | |
this.pin.anchor.setTo(0.5, 0.5); | |
this.addChild(this.pin); | |
/* Invisible sprite that players actually drag */ | |
var dragger = this.dragger = game.add.sprite(0, 0, null); |
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
//... | |
, game = new Phaser.Game(properties.size.x, properties.size.y, Phaser.AUTO, 'game'); | |
// Automatically register each state. | |
_.each(states, function(state, key) { | |
game.state.add(key, state(game)); | |
}); | |
//... |
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
var game = require('../common/game'); | |
class Camera extends Phaser.Group { | |
constructor({x = 0, y = 0}) { | |
super(game); | |
var {world, physics, camera} = game; | |
var {centerX, centerY, bounds} = world; | |
this.scale.setTo(1, 1); |
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
abc |
NewerOlder