+ window.addEventListener("keydown", function(e) {
+ // Prevent default browser action for arrows and spacebar
+ if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
+ e.preventDefault();
+ }
+ }, false);
+
+ class Entity extends Phaser.Sprite {
+ constructor(x, y, sprite) {
+ super(game, x, y, sprite);
+ this.anchor.setTo(.5,.5);
+ this.scale.x = 0.5;
+ this.scale.y = this.scale.x;
+ }
+
+ enablePhysics() {
+ game.physics.arcade.enable(this);
+ this.body.bounce.y = 0.2;
+ this.body.bounce.x = 0.2;
+ this.body.gravity.y = 300;
+ this.body.collideWorldBounds = true;
+ }
+ }
+
+ class Player extends Entity {
+ constructor(x, y, sprite) {
+ super(x, y, sprite);
+ this.anchor.setTo(.4,.5);
+ this.pushed = 0;
+ this.shape = SHAPE_GIRL;
+ this.learnedBird = false;
+ }
+ }
+
+ class Guard extends Entity {
+ constructor(x, y, sprite, dialogues) {
+ //var guard = game.add.sprite(x, y, sprite);
+ super(x, y, sprite);
+ this.dialogues = dialogues;
+ guards.add(this);
+ }
+ }
+