-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Rock_Puzzle_Game #3443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Rock_Puzzle_Game #3443
Conversation
games/Rock_Puzzle_Game.js
Outdated
|
|
||
| afterInput(() => { | ||
| if (tilesWith(player, goal).length > 0) { | ||
| setMap(levels[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Hardcoded level transition setMap(levels[1]) lacks bounds checking and proper win condition handling.
Severity: HIGH | Confidence: 0.95
🔍 Detailed Analysis
The game hardcodes setMap(levels[1]) on line 145 without checking if levels[1] exists or if it's the final level. This leads to several issues: 1) If levels[1] is ever removed or becomes undefined, calling setMap(undefined) could cause unexpected behavior or a crash. 2) When the player completes the final level (level 1), the game enters an infinite loop where setMap(levels[1]) is repeatedly called on every subsequent input, preventing a win message and creating a poor user experience. 3) The level variable declared on line 88 is unused, indicating an incomplete level progression system.
💡 Suggested Fix
Implement a proper level progression system using the level variable. Increment level after completing a map, check if (levels[level] !== undefined) before calling setMap(levels[level]), and display a win message if no more levels exist.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: games/Rock_Puzzle_Game.js#L145
Potential issue: The game hardcodes `setMap(levels[1])` on line 145 without checking if
`levels[1]` exists or if it's the final level. This leads to several issues: 1) If
`levels[1]` is ever removed or becomes `undefined`, calling `setMap(undefined)` could
cause unexpected behavior or a crash. 2) When the player completes the final level
(level 1), the game enters an infinite loop where `setMap(levels[1])` is repeatedly
called on every subsequent input, preventing a win message and creating a poor user
experience. 3) The `level` variable declared on line 88 is unused, indicating an
incomplete level progression system.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2712137
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only 2 levels, so I'm not sure what I could do better regarding this. Nothing edits the amount of levels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the level vairable
|
Please update the date in your metadata! |
|
@whatwareweb i have done so |
|
ok metadata looks good, a reviewer will check your game soon, thank you! |
whatwareweb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, please add some more content to this game to justify a Sprig device grant. Some ideas are more levels, more unique game mechanics, more artwork, music etc.
|
Reminder your game has to have more than a minute of gameplay, preferably even more than that. |
|
@whatwareweb is simply adding more levels sufficient? |
|
More levels would be good, but just more content in general. the thing i am looking for the most is unique game mechanics so if you can add some more advanced game mechanics in your new levels that would be the best |
|
Okay, @whatwareweb I have added the ability to reset the level with J. As well, there is an additional level. Should I add more levels? |
Your checklist for this pull request
Author name
**Author:**Hadi Abbasi/5ghzx
About your game
What is your game about? My game is a puzzle game where you must push rocks out of the way to reach the exit. But beware. If you push the rocks the wrong way, you will block your path and trap yourself.
How do you play your game? Use WASD keys to move. Move into rocks to push them. Press J to restart the level.
Code
Check off the items that are true.
/gamesdirectory.-s, or_s.Image (If an image is used)
/games/imgdirectory.