Skip to content
Open
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
354 changes: 354 additions & 0 deletions games/Paws-Up!.js
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
}
})
Comment on lines +247 to +257
Copy link

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 -3 Y-offset unconditionally, leading to inconsistent and unintended jump heights.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The getFirst(player).y -= 3 statement on line 255 is incorrectly indented, causing it to always execute when isGrounded() is true, regardless of the preceding if/else if block. This leads to inconsistent jump heights: 4 tiles up if y < 2, 5 tiles up if 2 <= y < 3, and 3 tiles up if y >= 3. This breaks core platformer logic and makes gameplay unpredictable.

💡 Suggested Fix

Restructure the jump logic to ensure getFirst(player).y -= 3 is applied conditionally, perhaps within an else block, or combine the conditional offsets into single statements to prevent double application.

🤖 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/Paws-Up!.js#L247-L257

Potential issue: The `getFirst(player).y -= 3` statement on line 255 is incorrectly
indented, causing it to always execute when `isGrounded()` is true, regardless of the
preceding `if/else if` block. This leads to inconsistent jump heights: 4 tiles up if `y
< 2`, 5 tiles up if `2 <= y < 3`, and 3 tiles up if `y >= 3`. This breaks core
platformer logic and makes gameplay unpredictable.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 5945550


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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Score text is rendered off-screen at x: 17 because game maps are only 10 tiles wide, making the score invisible.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The score text is rendered at x: 17 in addText calls (lines 327-331, 289-293, 345-349). All game maps are only 10 tiles wide (valid x-coordinates 0-9). This causes the score to be rendered completely off-screen and invisible to the player, breaking a critical UI element.

💡 Suggested Fix

Adjust the x coordinate for addText calls displaying the score to be within the visible map width (e.g., x: 0 to x: 9).

🤖 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/Paws-Up!.js#L289-L293

Potential issue: The score text is rendered at `x: 17` in `addText` calls (lines
327-331, 289-293, 345-349). All game maps are only 10 tiles wide (valid x-coordinates
0-9). This causes the score to be rendered completely off-screen and invisible to the
player, breaking a critical UI element.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 5945550

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);