updejt
This commit is contained in:
@@ -44,6 +44,12 @@ class Player {
|
||||
takeDamage(amount) {
|
||||
if (this.isDead) return;
|
||||
|
||||
// GOD MODE - Invincibility
|
||||
if (window.godMode) {
|
||||
console.log('⚡ GOD MODE: Damage blocked!');
|
||||
return;
|
||||
}
|
||||
|
||||
this.hp -= amount;
|
||||
console.log(`Player HP: ${this.hp}`);
|
||||
|
||||
@@ -523,8 +529,11 @@ class Player {
|
||||
const success = this.scene.farmingSystem.tillSoil(gridX, gridY);
|
||||
if (success) {
|
||||
console.log('✅ Tilled soil!');
|
||||
// Particle effect - soil spray
|
||||
this.createSoilParticles(gridX, gridY);
|
||||
// Tool swing animation
|
||||
this.swingTool();
|
||||
// TODO: Play dig sound
|
||||
// TODO: Tool swing animation
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -536,6 +545,8 @@ class Player {
|
||||
if (success) {
|
||||
invSys.removeItem(itemType, 1);
|
||||
console.log('🌱 Planted seed!');
|
||||
// Particle effect - seed drop
|
||||
this.createSeedParticles(gridX, gridY);
|
||||
// TODO: Play plant sound
|
||||
}
|
||||
return;
|
||||
@@ -546,10 +557,97 @@ class Player {
|
||||
const success = this.scene.farmingSystem.harvestCrop(gridX, gridY);
|
||||
if (success) {
|
||||
console.log('🌾 Harvested crop!');
|
||||
// Particle effect - harvest sparkle
|
||||
this.createHarvestParticles(gridX, gridY);
|
||||
// Camera shake
|
||||
this.scene.cameras.main.shake(200, 0.003);
|
||||
// TODO: Play harvest sound
|
||||
// TODO: Screen shake
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
swingTool() {
|
||||
if (!this.handSprite || !this.handSprite.visible) return;
|
||||
|
||||
// Save original position
|
||||
const originalAngle = this.handSprite.angle;
|
||||
const originalScale = this.handSprite.scaleX;
|
||||
|
||||
// Swing animation
|
||||
this.scene.tweens.add({
|
||||
targets: this.handSprite,
|
||||
angle: originalAngle - 45,
|
||||
scaleX: originalScale * 1.3,
|
||||
scaleY: originalScale * 1.3,
|
||||
duration: 100,
|
||||
yoyo: true,
|
||||
ease: 'Cubic.easeOut',
|
||||
onComplete: () => {
|
||||
this.handSprite.angle = originalAngle;
|
||||
this.handSprite.scaleX = originalScale;
|
||||
this.handSprite.scaleY = originalScale;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
createSoilParticles(gridX, gridY) {
|
||||
const screenPos = this.scene.iso.gridToScreen(gridX, gridY);
|
||||
const x = screenPos.x + this.offsetX;
|
||||
const y = screenPos.y + this.offsetY;
|
||||
|
||||
// Brown soil particles
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const particle = this.scene.add.circle(x, y, 3, 0x8B4513);
|
||||
this.scene.tweens.add({
|
||||
targets: particle,
|
||||
x: x + (Math.random() - 0.5) * 30,
|
||||
y: y - Math.random() * 20,
|
||||
alpha: 0,
|
||||
duration: 400,
|
||||
onComplete: () => particle.destroy()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createSeedParticles(gridX, gridY) {
|
||||
const screenPos = this.scene.iso.gridToScreen(gridX, gridY);
|
||||
const x = screenPos.x + this.offsetX;
|
||||
const y = screenPos.y + this.offsetY;
|
||||
|
||||
// Green seed particles
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const particle = this.scene.add.circle(x, y - 20, 2, 0x00ff00);
|
||||
this.scene.tweens.add({
|
||||
targets: particle,
|
||||
y: y,
|
||||
alpha: 0,
|
||||
duration: 500,
|
||||
ease: 'Cubic.easeIn',
|
||||
onComplete: () => particle.destroy()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createHarvestParticles(gridX, gridY) {
|
||||
const screenPos = this.scene.iso.gridToScreen(gridX, gridY);
|
||||
const x = screenPos.x + this.offsetX;
|
||||
const y = screenPos.y + this.offsetY;
|
||||
|
||||
// Golden sparkle particles
|
||||
for (let i = 0; i < 15; i++) {
|
||||
const particle = this.scene.add.circle(x, y, 4, 0xFFD700);
|
||||
this.scene.tweens.add({
|
||||
targets: particle,
|
||||
x: x + (Math.random() - 0.5) * 40,
|
||||
y: y - Math.random() * 40,
|
||||
scaleX: 0,
|
||||
scaleY: 0,
|
||||
alpha: 0,
|
||||
duration: 600,
|
||||
ease: 'Cubic.easeOut',
|
||||
onComplete: () => particle.destroy()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user