Open Coding Society - Pirate Mega Game, Do you dare to play?
Start interactive experience by pressing "Play".
🏴☠️ Pirate Hunt — Update Summary
🔧 What did we change?
- Added a new level that serves as the foundation for:
- Gravity
- Local storage
- Leaderboard
- Player death cycle (for the player, not the enemy)
🎯 Why did we change it?
- To improve the game using new lessons learned
- To collaborate with other teams and integrate shared features
- To prepare the project for more advanced mechanics
📁 What files were updated?
- All files inside
_projects/pirate-hunt/ - Most notably:
notebook.src.ipynbnew-level.js
🧪 How did we test it?
- Ran the game on localhost
- Verified behavior on the live deployed site
- Tested across multiple computers
- Ensured everything stayed up to date
🚀 What’s next?
- Continue integrating new features
- Seamlessly connect additional levels
- Maintain strong team communication as the game expands
Code for Gravity:
%%js
let y = 100;
let vy = 0;
const gravity = 0.5;
function update() {
vy += gravity; // gravity pulls down
y += vy; // apply movement
console.log("Player height:", y);
}
// Simulate frames
for (let i = 0; i < 5; i++) {
update();
}
flowchart TD
%% --- FLOW ---
A([Constantly Check Player State]) --> B{Life or Death Conditions?}
B -- Life Satisfied --> C[Player Continues Playing<br/>No Death Cycle Triggered]
B -- Death Satisfied --> D[Destroy Player Object]
D --> E[Start Respawn Cycle]
E --> F[Prompt: "Would you like to try again?"]
F --> G{Player Choice?}
G -- Yes --> H[Respawn Player<br/>Reset Position, Velocity, Flags]
H --> A
G -- No --> I([End Game / Return to Menu])