projects
/
shapeshift.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dca5c89
)
Reorganized code: created Entity base class
master
author
MegaBrutal
<code+git@megabrutal.com>
Thu, 23 Mar 2017 07:16:22 +0000
(08:16 +0100)
committer
MegaBrutal
<code+git@megabrutal.com>
Thu, 23 Mar 2017 07:16:22 +0000
(08:16 +0100)
modified: shapeshift.js
shapeshift.js
patch
|
blob
|
history
diff --git
a/shapeshift.js
b/shapeshift.js
index 37481aaab41c2f94088815ffebe602a3e738b873..14b4fda470cdcb3ee4ed6b72c01fde2a890ac306 100644
(file)
--- a/
shapeshift.js
+++ b/
shapeshift.js
@@
-63,15
+63,12
@@
}
}, false);
}
}, false);
- class
Player
extends Phaser.Sprite {
+ class
Entity
extends Phaser.Sprite {
constructor(x, y, sprite) {
super(game, x, y, sprite);
constructor(x, y, sprite) {
super(game, x, y, sprite);
- this.anchor.setTo(.
4
,.5);
+ this.anchor.setTo(.
5
,.5);
this.scale.x = 0.5;
this.scale.y = this.scale.x;
this.scale.x = 0.5;
this.scale.y = this.scale.x;
- this.pushed = 0;
- this.shape = SHAPE_GIRL;
- this.learnedBird = false;
}
enablePhysics() {
}
enablePhysics() {
@@
-83,24
+80,23
@@
}
}
}
}
- class Guard extends Phaser.Sprite {
+ 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);
constructor(x, y, sprite, dialogues) {
//var guard = game.add.sprite(x, y, sprite);
- super(game, x, y, sprite);
- this.anchor.setTo(.5,.5);
- this.scale.x = 0.5;
- this.scale.y = this.scale.x;
+ super(x, y, sprite);
this.dialogues = dialogues;
guards.add(this);
}
this.dialogues = dialogues;
guards.add(this);
}
-
- 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;
- }
}
function sign(n) {
}
function sign(n) {