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