-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Sprig App] Paws Up! #3508
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! #3508
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 Cat Home!", { | ||
| 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`, | ||
| }) | ||
|
Comment on lines
+289
to
+293
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: Score text is rendered off-screen at 🔍 Detailed AnalysisThe score text is rendered at 💡 Suggested FixAdjust the 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| 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; | ||
| } | ||
| 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: The jump logic incorrectly applies a
-3Y-offset unconditionally, leading to inconsistent and unintended jump heights.Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The
getFirst(player).y -= 3statement on line 255 is incorrectly indented, causing it to always execute whenisGrounded()is true, regardless of the precedingif/else ifblock. This leads to inconsistent jump heights: 4 tiles up ify < 2, 5 tiles up if2 <= y < 3, and 3 tiles up ify >= 3. This breaks core platformer logic and makes gameplay unpredictable.💡 Suggested Fix
Restructure the jump logic to ensure
getFirst(player).y -= 3is applied conditionally, perhaps within anelseblock, or combine the conditional offsets into single statements to prevent double application.🤖 Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID:
5945550