-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Sprig App] Paws Up! #3507
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?
[Sprig App] Paws Up! #3507
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,354 @@ | ||
| /* | ||
| @title: Paws Up! | ||
| @description: Paws up is a challenging game where you a cat jump onto platforms. | ||
| @tags: ['platformer'] | ||
| @addedOn: 2025-012-06 | ||
|
|
||
| @img: "" | ||
| */ | ||
|
|
||
| const coin = "c" | ||
| const player = "p" | ||
| const island = "i" | ||
| const background = "b" | ||
| const counter = "x" | ||
| var total = "0"; | ||
| const portal = "z" | ||
|
|
||
|
|
||
|
|
||
| setLegend( | ||
| [player, bitmap` | ||
| ................ | ||
| ........0.....0. | ||
| .......010...010 | ||
| ..00...021000120 | ||
| .0220..011LLL110 | ||
| 01120..0L10110L0 | ||
| 0L10...011111110 | ||
| 010....0L11221L0 | ||
| 0L0....00122220. | ||
| 010...0L1LLLL0.. | ||
| 01L0001L11LL10.. | ||
| .0110L11L11110.. | ||
| ..0001L1111110.. | ||
| ....0110110110.. | ||
| ....0220220220.. | ||
| ....0000000000..`], | ||
| [coin, bitmap` | ||
| ................ | ||
| ................ | ||
| ..........LLL... | ||
| .......L..LLLL.. | ||
| L....L..L.LLLLL. | ||
| LL.L..L.L.L...LL | ||
| .LL.L.L.L.L.L.LL | ||
| ..LLLLLLLLL...L. | ||
| .LL.......LLLL.L | ||
| LL..L.L.L.LLL.LL | ||
| L..L..L.L.LLLLL. | ||
| .....L..L.LLLL.. | ||
| .......L..LLL... | ||
| ................ | ||
| ................ | ||
| ................`], | ||
| [island, bitmap` | ||
| 0000000000000000 | ||
| 0DDDDDDDDDDDDDD0 | ||
| 0DDDDDDDDDDDDDD0 | ||
| 00DD00DD00DD00D0 | ||
| 0C00CC00CC00CC00 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0CCCCCCCCCCCCCC0 | ||
| 0000000000000000`], | ||
| [background, bitmap` | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777 | ||
| 7777777777777777`], | ||
| [counter, bitmap` | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ................ | ||
| ....L.L..L..LL.. | ||
| ....LL.L..L.L.L. | ||
| .....LLLLLLLLLLL | ||
| ....LL......LLL. | ||
| ....L..L..L.LL.. | ||
| ......L..L......`], | ||
| [portal, bitmap` | ||
| .....000000..... | ||
| ....00882200.... | ||
| ...00H3333200... | ||
| ..00H333333800.. | ||
| .00333333333800. | ||
| 0033330000333800 | ||
| 0000002222000000 | ||
| ..022222222220.. | ||
| ..022200002220.. | ||
| ..0220LLLL0220.. | ||
| ..0201111LL020.. | ||
| ..02011111L020.. | ||
| ..02011111L020.. | ||
| ..02011111L020.. | ||
| ..02011111L020.. | ||
| ..02011111L020..`] | ||
| ) | ||
|
|
||
| setSolids([player, island]) | ||
|
|
||
| let level = 0; | ||
| const levels = [ | ||
| map` | ||
| bbbbbbbbbb | ||
| bbbbbbbbbb | ||
| bbbbbbbbbb | ||
| bbbbbbbbbb | ||
| bbbbbbbbbb | ||
| pbbbbbbbbz | ||
| iiiiiiiiii | ||
| bbbbbbbbbb`, | ||
| map` | ||
| ....c..x.. | ||
| .......... | ||
| .........z | ||
| .........i | ||
| ....i..cii | ||
| p.iii..iii | ||
| iiiiiiiii. | ||
| ..........`, | ||
| map` | ||
| ...c...x.. | ||
| .......... | ||
| .......... | ||
| ...ii..c.. | ||
| ..iiii.... | ||
| piiiiiii.z | ||
| iiiiiiiiii | ||
| ..........`, | ||
| map` | ||
| ..c....x.. | ||
| ..i......c | ||
| ..i..iiiii | ||
| ..i....iii | ||
| .iii....ii | ||
| piii....zi | ||
| iiiiiiiiii | ||
| ..........`, | ||
| map` | ||
| .......x.. | ||
| .......... | ||
| ...c...... | ||
| ......i... | ||
| ...i..c... | ||
| p........z | ||
| i.i..i...i | ||
| ..........`, | ||
| map` | ||
| .......x.. | ||
| ..c....... | ||
| ...c...... | ||
| .p..c..... | ||
| .i...c.... | ||
| ......z... | ||
| i.....i... | ||
| ..........`, | ||
| map` | ||
| ....c..x.. | ||
| ........z. | ||
| ....i...i. | ||
| .......... | ||
| ..i..ci.c. | ||
| p......... | ||
| i....i..i. | ||
| ..........`, | ||
| map` | ||
| c......x.. | ||
| i.iiii..i. | ||
| .......... | ||
| ......ii.. | ||
| .ii.c..... | ||
| p.......z. | ||
| i...i...i. | ||
| ..........`, | ||
| map` | ||
| .......x.. | ||
| .......... | ||
| ..cc..cz.. | ||
| ..cc..cc.. | ||
| .........i | ||
| p.i....i.. | ||
| i..iiii... | ||
| ..........`, | ||
|
|
||
| ] | ||
|
|
||
| addText("Welcome To \nPaws Up!", { | ||
| x: 2, | ||
| y: 2, | ||
| color: color`0`,}); | ||
| addText("W: Jump\nA: Right\nD: Left", { | ||
| x: 5, | ||
| y: 7, | ||
| color: color`0`,}); | ||
| addText("Go to the portal!", { | ||
| x: 1, | ||
| y: 5, | ||
| color: color`0`,}); | ||
|
|
||
| const endScreen = map` | ||
| .......x.. | ||
| .......... | ||
| .......... | ||
| .......... | ||
| .......... | ||
| .......... | ||
| p......... | ||
| iiiiiiiiii`; | ||
| setMap(levels[level]) | ||
| setBackground(background); | ||
|
|
||
| /*setPushables({ | ||
| [ player ]: [] | ||
| })*/ | ||
|
|
||
| /*onInput("s", () => { | ||
|
|
||
| getFirst(player).y += 1 | ||
| })*/ | ||
|
|
||
| onInput("w", () => { | ||
| if (isGrounded()) { | ||
| if (getFirst(player).y < 2) { | ||
| getFirst(player).y -= 1; | ||
| } else if (getFirst(player).y < 3) { | ||
| getFirst(player).y -= 2; | ||
| } | ||
|
|
||
| getFirst(player).y -= 3 | ||
| } | ||
| }) | ||
|
|
||
| onInput("a", () => { | ||
| getFirst(player).x -= 1 | ||
| }) | ||
|
|
||
| onInput("d", () => { | ||
| getFirst(player).x += 1 | ||
| }) | ||
|
|
||
| var done = false; | ||
|
|
||
| function levelEnd() { | ||
| let obstacles = getFirst(portal); | ||
| let p = getFirst(player); | ||
| if (obstacles.x == p.x && obstacles.y == p.y) { | ||
|
|
||
| if (level > levels.length - 2) { | ||
|
|
||
|
|
||
| setMap(endScreen) | ||
| addText("Thank You \nFor Playing", { | ||
| x: 5, | ||
| y: 5, | ||
| color: color`0`, | ||
| }); | ||
| done = true; | ||
| return; | ||
| } | ||
|
|
||
| level++; | ||
| clearText(); | ||
| addText(total.toString(), { | ||
| x: 17, | ||
| y: 1, | ||
| color: color`0`, | ||
| }) | ||
| setMap(levels[level]); | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| function isGrounded() { | ||
| let obstacles = getAll(island); | ||
| let p = getFirst(player); | ||
| for (let i = 0; i < obstacles.length; i++) { | ||
| if (obstacles[i].x == p.x && obstacles[i].y == (p.y + 1)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| function checkHit() { | ||
| let obstacles = getAll(coin); | ||
| let p = getFirst(player); | ||
|
|
||
| for (let i = 0; i < obstacles.length; i++) { | ||
| if (obstacles[i].x == p.x && obstacles[i].y == p.y) { | ||
| let tempX = p.x; | ||
| let tempY = p.y; | ||
| clearTile(tempX, tempY); | ||
| addSprite(tempX, tempY, player); | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| addText("0", { | ||
| x: 17, | ||
| y: 1, | ||
| color: color`0`, | ||
| }) | ||
| let check = 0; | ||
| var gameLoop = setInterval(() => { | ||
| check++; | ||
| isGrounded(); | ||
| if (!done) { | ||
| levelEnd(); | ||
| } | ||
| if (getFirst(player).y > 6) { | ||
| getFirst(player).y = 5; | ||
| getFirst(player).x = 0; | ||
| } | ||
|
Comment on lines
+339
to
+342
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Player reset logic hardcodes 🔍 Detailed AnalysisThe player reset logic at 💡 Suggested FixModify the reset logic to dynamically determine the correct starting position for the current level, or store level-specific starting coordinates to use upon reset. 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| if (checkHit()) { | ||
| total++; | ||
| addText(total.toString(), { | ||
| x: 17, | ||
| y: 1, | ||
| color: color`0`, | ||
| }) | ||
| } | ||
| if ((check % 2) == 0) { | ||
| getFirst(player).y += 1; | ||
| } | ||
| }, 100); | ||
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: Unconditional
getFirst(player).y -= 3in jump logic causes inconsistent jump heights.Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The
onInput("w")handler atgames/Paws-Up!.js:247~256contains an unconditionalgetFirst(player).y -= 3statement. This statement executes after anif/else ifblock, leading to inconsistent jump heights (4, 5, or 3 tiles up) depending on the player'syposition. This breaks the core jumping mechanic in a platformer game, making precise jumps unreliable.💡 Suggested Fix
Remove the unconditional
getFirst(player).y -= 3, or nest it within anelseclause, or restructure the conditional logic to ensure consistent jump behavior.🤖 Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID:
5945503