charakter
This commit is contained in:
@@ -92,18 +92,14 @@ class Player {
|
||||
}
|
||||
|
||||
createSprite() {
|
||||
// NEW: Use player_dreadlocks sprite (isometric 2.5D)
|
||||
let texKey = 'player_dreadlocks';
|
||||
// KRVAVA ŽETEV: Use new protagonist sprite
|
||||
let texKey = 'player_protagonist';
|
||||
|
||||
// Fallback chain if new sprite not loaded
|
||||
// Fallback to generated sprite if not loaded
|
||||
if (!this.scene.textures.exists(texKey)) {
|
||||
texKey = this.scene.textures.exists('player_walk') ? 'player_walk' : 'player_sprite';
|
||||
if (!this.scene.textures.exists(texKey)) {
|
||||
texKey = 'player';
|
||||
if (!this.scene.textures.exists(texKey)) {
|
||||
TextureGenerator.createPlayerSprite(this.scene, texKey);
|
||||
}
|
||||
}
|
||||
console.warn('⚠️ player_protagonist sprite not found! Generating fallback...');
|
||||
TextureGenerator.createPlayerSprite(this.scene, 'player_fallback');
|
||||
texKey = 'player_fallback';
|
||||
}
|
||||
|
||||
// Kreira sprite
|
||||
@@ -113,15 +109,13 @@ class Player {
|
||||
screenPos.y + this.offsetY,
|
||||
texKey
|
||||
);
|
||||
this.sprite.setOrigin(0.5, 1);
|
||||
this.sprite.setOrigin(0.5, 0.8); // Changed from 1 to 0.8 to show legs
|
||||
|
||||
// Scale based on sprite type
|
||||
if (texKey === 'player_dreadlocks') {
|
||||
this.sprite.setScale(2.5); // MUCH larger for better visibility
|
||||
} else if (texKey === 'player_walk') {
|
||||
this.sprite.setScale(2.5); // Old animated sprite
|
||||
if (texKey === 'player_protagonist') {
|
||||
this.sprite.setScale(1.0); // Smaller protagonist sprite
|
||||
} else {
|
||||
this.sprite.setScale(1.2); // Old static sprite
|
||||
this.sprite.setScale(1.0); // Fallback sprite
|
||||
}
|
||||
|
||||
|
||||
@@ -343,10 +337,35 @@ class Player {
|
||||
this.lastDir = { x: dx, y: dy };
|
||||
this.sprite.setFlipX(!facingRight);
|
||||
|
||||
// Play walking animation (with safety check)
|
||||
if (this.sprite.anims) {
|
||||
try {
|
||||
if (this.scene.anims.exists('protagonist_walk') && !this.sprite.anims.isPlaying) {
|
||||
this.sprite.play('protagonist_walk');
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore animation errors
|
||||
}
|
||||
}
|
||||
|
||||
// Hand offset
|
||||
const handOffset = facingRight ? 10 : -10;
|
||||
this.handSprite.setX(this.sprite.x + handOffset);
|
||||
this.handSprite.setFlipX(!facingRight);
|
||||
} else {
|
||||
// Stop animation when idle (with safety check)
|
||||
if (this.sprite.anims) {
|
||||
try {
|
||||
if (this.sprite.anims.isPlaying) {
|
||||
this.sprite.stop();
|
||||
}
|
||||
if (this.scene.anims.exists('protagonist_idle')) {
|
||||
this.sprite.play('protagonist_idle');
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore animation errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collision Check
|
||||
|
||||
Reference in New Issue
Block a user