added jump

Signed-off-by: Pascal Syma <pascal@syma.dev>
This commit is contained in:
2020-07-17 03:40:42 +02:00
parent 13e7c24b65
commit 9194dc50ed
6 changed files with 25 additions and 3 deletions
+2 -1
View File
@@ -14,6 +14,7 @@ export default class Player extends Entity {
constructor(scene, spawnPoint, texture) {
super(scene, spawnPoint.x, spawnPoint.y, texture);
this.setData("speed", 100);
this.setData('jump', 1.5)
this.setData('hp', 10);
this.setOrigin(0.5, 1).setScale(32 / 48);
@@ -74,7 +75,7 @@ export default class Player extends Entity {
// Jumping, Dashing
if (this.scene.upActive() && this.body.blocked.down) {
this.body.velocity.y = -this.getData('speed') * 1.5;
this.body.velocity.y = -this.getData('speed') * this.getData('jump');
}
// Walking L R