Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions artifact/assets/astroids/instructions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Rework the JavaScript to remove all leftover change markers & duplicate code. Address the issues by simplifying and structuring the code:

### Instructions:
1. **Remove All Change Markers**: Remove any `<<<<<<<`, `=======`, `>>>>>>>` remnants from previous conflicting merges or update attempts.
2. **Centralize `generateShape()` Logic**: Ensure this method is only called once per object creation (e.g., in `Asteroid` or `Spaceship` constructors). Remove duplicates completely.
3. **Cleanup of Classes and Objects**:
- Separate and clearly define shared properties of asteroids, bullets, and spaceship.
- Ensure all elements (asteroids, bullets, spaceship states) are cleanly updated and rendered in the game loop.
4. **Improve Game Flow**:
- Ensure all global variables (score, lives, gameOver, etc.) and game state are properly governed and readable.
- Make restarting smoother and consistent.
5. **Fix Edge Cases**:
- Check collisions and interactions to ensure they logically work without overlaps or missing functionality.
- Manage object removal more robustly when out-of-bounds or destroyed.
6. **Final Testing**: The game should run with proper features and no residual issues.

Result: A clean, error-free, and structured codebase where functionalities are compartmentalized, and the overall gameplay logic is functional and easier to maintain.
25 changes: 25 additions & 0 deletions artifact/assets/astroids/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
body {
margin: 0;
overflow: hidden;
background-color: black;
color: white;
font-family: Arial, sans-serif;
}

canvas {
display: block;
}

#score {
position: absolute;
top: 10px;
left: 10px;
font-size: 20px;
}

#lives {
position: absolute;
top: 10px;
right: 10px;
font-size: 20px;
}
4 changes: 4 additions & 0 deletions artifact/assets/astroids/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<canvas id="gameCanvas"></canvas>
<audio id="thrustSound" src="https://cdn.jsdelivr.net/gh/mdn/webaudio-examples/audio-context-basics/thruster.wav"></audio>
<audio id="fireSound" src="https://cdn.jsdelivr.net/gh/mdn/webaudio-examples/audio-context-basics/beep.wav"></audio>
<audio id="explodeSound" src="https://cdn.jsdelivr.net/gh/mdn/webaudio-examples/audio-context-basics/explosion.wav"></audio>
Loading