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 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
}
Comment on lines +247 to +256
Copy link

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 -= 3 in jump logic causes inconsistent jump heights.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The onInput("w") handler at games/Paws-Up!.js:247~256 contains an unconditional getFirst(player).y -= 3 statement. This statement executes after an if/else if block, leading to inconsistent jump heights (4, 5, or 3 tiles up) depending on the player's y position. 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 an else clause, or restructure the conditional logic to ensure consistent jump behavior.

🤖 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-L256

Potential issue: The `onInput("w")` handler at `games/Paws-Up!.js:247~256` contains an
unconditional `getFirst(player).y -= 3` statement. This statement executes after an
`if/else if` block, leading to inconsistent jump heights (4, 5, or 3 tiles up) depending
on the player's `y` position. This breaks the core jumping mechanic in a platformer
game, making precise jumps unreliable.

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

})

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

Choose a reason for hiding this comment

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

Bug: Player reset logic hardcodes (0, 5) position, which is incorrect for Level 5's starting position (1, 3).
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The player reset logic at games/Paws-Up!.js:339~342 hardcodes the reset position to (0, 5) when the player falls. However, Level 5's intended starting position is (1, 3). When a player falls in Level 5, they are incorrectly reset to (0, 5), which breaks level progression and gameplay for that specific level.

💡 Suggested Fix

Modify 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 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#L339-L342

Potential issue: The player reset logic at `games/Paws-Up!.js:339~342` hardcodes the
reset position to `(0, 5)` when the player falls. However, Level 5's intended starting
position is `(1, 3)`. When a player falls in Level 5, they are incorrectly reset to `(0,
5)`, which breaks level progression and gameplay for that specific level.

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

if (checkHit()) {
total++;
addText(total.toString(), {
x: 17,
y: 1,
color: color`0`,
})
}
if ((check % 2) == 0) {
getFirst(player).y += 1;
}
}, 100);