Skip to content
Snippets Groups Projects
Commit 5b5cf807 authored by Paolo.Brasolin's avatar Paolo.Brasolin
Browse files

refactor: #fe improve player placement

parent 38fddc9a
No related branches found
No related tags found
No related merge requests found
...@@ -163,21 +163,22 @@ export default class FightScene extends Phaser.Scene { ...@@ -163,21 +163,22 @@ export default class FightScene extends Phaser.Scene {
createPlayer() { createPlayer() {
this.player = this.physics.add this.player = this.physics.add
.sprite( .sprite(0, 0, "oezi")
this.cameras.main.width + 300,
this.cameras.main.height - 100,
"oezi",
)
.setScale(3) .setScale(3)
.setInteractive(); .setInteractive();
this.player.setPosition(
// NOTE: just outside the bound and above the ground
this.cameras.main.width + 0.5 * this.player.displayWidth,
this.cameras.main.height - 30 - 0.5 * this.player.displayHeight,
);
this.player.flipX = true; this.player.flipX = true;
this.player.play({ key: "player_run" }); this.player.play({ key: "player_run" });
this.player.setCollideWorldBounds(true); this.player.setCollideWorldBounds(true);
this.tweens.add({ this.tweens.add({
targets: this.player, targets: this.player,
x: this.cameras.main.width - 80, x: this.cameras.main.width - this.player.displayWidth * 0.5,
ease: "Power2", ease: "Power2",
duration: 2000, duration: 1000,
onComplete: () => { onComplete: () => {
this.player.play({ key: "player_run", repeat: -1 }); this.player.play({ key: "player_run", repeat: -1 });
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment