Decouple travel and cooking fuel mechanics
- Travel is now free (no fuel cost for sailing between locations) - Fuel is only consumed for cooking whale oil (2 fuel per whale) - Updated TransitionScene to show "The wind carries your sails..." when no fuel cost - Removed fuel checks from MapScene travel methods - Added fuel validation in HuntingScene - can't process whales without fuel - This sets up the penguin burning mechanic for when cooking fuel runs low 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -366,6 +366,24 @@ export default class HuntingScene extends Phaser.Scene {
|
|||||||
whale.setData('alive', false);
|
whale.setData('alive', false);
|
||||||
harpoon.setData('active', false);
|
harpoon.setData('active', false);
|
||||||
|
|
||||||
|
// Check if enough fuel to process the whale
|
||||||
|
if (this.inventory.fuel < 2) {
|
||||||
|
// Not enough fuel to cook the oil!
|
||||||
|
this.tweens.add({
|
||||||
|
targets: whale,
|
||||||
|
alpha: 0,
|
||||||
|
y: whale.y + 50,
|
||||||
|
duration: 1000,
|
||||||
|
onComplete: () => {
|
||||||
|
whale.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
harpoon.destroy();
|
||||||
|
|
||||||
|
this.showMessage('Whale hit but no fuel to process it! Need 2 fuel to cook whale oil.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Whale death animation
|
// Whale death animation
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
targets: whale,
|
targets: whale,
|
||||||
@@ -381,13 +399,16 @@ export default class HuntingScene extends Phaser.Scene {
|
|||||||
// Remove harpoon
|
// Remove harpoon
|
||||||
harpoon.destroy();
|
harpoon.destroy();
|
||||||
|
|
||||||
|
// Consume fuel for processing
|
||||||
|
this.inventory.fuel -= 2;
|
||||||
|
|
||||||
// Reward
|
// Reward
|
||||||
this.inventory.whaleOil += 1;
|
this.inventory.whaleOil += 1;
|
||||||
this.whalesHunted++;
|
this.whalesHunted++;
|
||||||
this.updateStats();
|
this.updateStats();
|
||||||
|
|
||||||
// Show success message
|
// Show success message
|
||||||
this.showMessage(`Whale hunted! +1 Whale Oil (Total: ${this.inventory.whaleOil})`);
|
this.showMessage(`Whale hunted! +1 Whale Oil, -2 Fuel (Oil: ${this.inventory.whaleOil}, Fuel: ${this.inventory.fuel})`);
|
||||||
|
|
||||||
// Success flash
|
// Success flash
|
||||||
const flash = this.add.rectangle(400, 300, 800, 600, 0xffffff, 0.3);
|
const flash = this.add.rectangle(400, 300, 800, 600, 0xffffff, 0.3);
|
||||||
|
|||||||
@@ -155,43 +155,31 @@ export default class MapScene extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goToHunting() {
|
goToHunting() {
|
||||||
if (this.inventory.fuel < 20) {
|
// Sailing is free - fuel is only for cooking
|
||||||
this.showMessage('Not enough fuel to reach the hunting grounds! You need at least 20 units.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Go to transition scene, then to hunting scene
|
|
||||||
this.scene.start('TransitionScene', {
|
this.scene.start('TransitionScene', {
|
||||||
inventory: this.inventory,
|
inventory: this.inventory,
|
||||||
destination: 'hunting',
|
destination: 'hunting',
|
||||||
fuelCost: 20,
|
fuelCost: 0,
|
||||||
nextScene: 'HuntingScene'
|
nextScene: 'HuntingScene'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
goToAntarctic() {
|
goToAntarctic() {
|
||||||
if (this.inventory.fuel < 30) {
|
// Sailing is free - fuel is only for cooking
|
||||||
this.showMessage('Not enough fuel to reach Antarctic islands! You need at least 30 units.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Go to transition scene, then to map (antarctic scene not yet implemented)
|
|
||||||
this.scene.start('TransitionScene', {
|
this.scene.start('TransitionScene', {
|
||||||
inventory: this.inventory,
|
inventory: this.inventory,
|
||||||
destination: 'antarctic',
|
destination: 'antarctic',
|
||||||
fuelCost: 30,
|
fuelCost: 0,
|
||||||
nextScene: 'MapScene' // Will change to 'AntarcticScene' when implemented
|
nextScene: 'MapScene' // Will change to 'AntarcticScene' when implemented
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
goToPort() {
|
goToPort() {
|
||||||
if (this.inventory.fuel < 10) {
|
// Sailing is free
|
||||||
this.showMessage('Not enough fuel to return to port! You need at least 10 units. Consider... alternatives.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Go to transition scene, then to map (port scene not yet implemented)
|
|
||||||
this.scene.start('TransitionScene', {
|
this.scene.start('TransitionScene', {
|
||||||
inventory: this.inventory,
|
inventory: this.inventory,
|
||||||
destination: 'port',
|
destination: 'port',
|
||||||
fuelCost: 10,
|
fuelCost: 0,
|
||||||
nextScene: 'MapScene' // Will change to 'PortScene' when implemented
|
nextScene: 'MapScene' // Will change to 'PortScene' when implemented
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,11 +45,19 @@ export default class TransitionScene extends Phaser.Scene {
|
|||||||
wordWrap: { width: 660 }
|
wordWrap: { width: 660 }
|
||||||
}).setOrigin(0.5);
|
}).setOrigin(0.5);
|
||||||
|
|
||||||
// Fuel cost display
|
// Fuel cost display (only if there's a cost)
|
||||||
this.add.text(400, 500, `Fuel consumed: ${this.fuelCost} units`, {
|
if (this.fuelCost > 0) {
|
||||||
fontSize: '16px',
|
this.add.text(400, 500, `Fuel consumed: ${this.fuelCost} units`, {
|
||||||
fill: '#ffff00'
|
fontSize: '16px',
|
||||||
}).setOrigin(0.5);
|
fill: '#ffff00'
|
||||||
|
}).setOrigin(0.5);
|
||||||
|
} else {
|
||||||
|
this.add.text(400, 500, 'The wind carries your sails...', {
|
||||||
|
fontSize: '16px',
|
||||||
|
fill: '#cccccc',
|
||||||
|
fontStyle: 'italic'
|
||||||
|
}).setOrigin(0.5);
|
||||||
|
}
|
||||||
|
|
||||||
// Continue button
|
// Continue button
|
||||||
const continueBtn = this.add.rectangle(400, 540, 200, 50, 0x2d5f8e);
|
const continueBtn = this.add.rectangle(400, 540, 200, 50, 0x2d5f8e);
|
||||||
@@ -72,8 +80,10 @@ export default class TransitionScene extends Phaser.Scene {
|
|||||||
});
|
});
|
||||||
|
|
||||||
continueBtn.on('pointerdown', () => {
|
continueBtn.on('pointerdown', () => {
|
||||||
// Deduct fuel
|
// Deduct fuel (if any cost)
|
||||||
this.inventory.fuel -= this.fuelCost;
|
if (this.fuelCost > 0) {
|
||||||
|
this.inventory.fuel -= this.fuelCost;
|
||||||
|
}
|
||||||
|
|
||||||
// Proceed to next scene
|
// Proceed to next scene
|
||||||
this.scene.start(this.nextScene, { inventory: this.inventory });
|
this.scene.start(this.nextScene, { inventory: this.inventory });
|
||||||
|
|||||||
Reference in New Issue
Block a user