FAZA 2: Fix player walk animation error - use static sprite for now

This commit is contained in:
2025-12-06 18:07:09 +01:00
parent 3086356171
commit 6e92e89f74

View File

@@ -27,9 +27,8 @@ class Player {
}
createSprite() {
// Generiraj player teksturo
// Generiraj player teksturo (static sprite)
TextureGenerator.createPlayerSprite(this.scene, 'player');
TextureGenerator.createPlayerWalkSprite(this.scene, 'player_walk');
// Kreira sprite
const screenPos = this.iso.toScreen(this.gridX, this.gridY);
@@ -39,18 +38,8 @@ class Player {
// Depth sorting
this.updateDepth();
// Dodaj walking animacijo
if (!this.scene.anims.exists('player_walk_anim')) {
this.scene.anims.create({
key: 'player_walk_anim',
frames: this.scene.anims.generateFrameNumbers('player_walk', {
start: 0,
end: 3
}),
frameRate: 8,
repeat: -1
});
}
// Walking animacija je onemogočena za FAZA 2 (fix za canvas texture issue)
// TODO: Dodaj proper sprite sheet animacijo v FAZA 3
}
setupControls() {
@@ -115,10 +104,7 @@ class Player {
const targetScreen = this.iso.toScreen(targetX, targetY);
// Animacija hoje
this.sprite.play('player_walk_anim', true);
// Tween za smooth gibanje
// Tween za smooth gibanje (brez animacije za zdaj)
this.scene.tweens.add({
targets: this.sprite,
x: targetScreen.x,
@@ -127,8 +113,6 @@ class Player {
ease: 'Linear',
onComplete: () => {
this.isMoving = false;
this.sprite.stop();
this.sprite.setFrame(0); // Idle frame
}
});