Skip to content

Commit c154801

Browse files
JungleHornetgrymmy
andauthored
[Sprig App Update] (#3008)
* Sprig App - CrocodileRun * Update crocodile run to v1.1.0 * updated crocodile run to v1.2.0 * update crocodile run to v1.2.1 * Update CrocodileRun to v1.2.2 * Update CrocodileRun to v1.2.3 --------- Co-authored-by: graham <graham@hackclub.com>
1 parent 82e0687 commit c154801

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

games/CrocodileRun.js

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,31 @@ Controls:
1717
I: Return to menu
1818
1919
Changelog:
20-
- v1.0.0 (1/11/2025) :
20+
- v1.0.0 (2/11/2025) :
2121
- Initial version
2222
23-
- v1.1.0 (1/12/2025) :
23+
- v1.1.0 (2/12/2025) :
2424
- Added alternate texture of house after winning
2525
- Updated logo with new house texture
2626
- Added increasing speed
2727
- Added animations for when the crocodiles eat the walls and the player
2828
29-
- v1.2.0 (1/12/2025) :
29+
- v1.2.0 (2/12/2025) :
3030
- Added main menu
3131
- Added endless mode
3232
- Added changelog
3333
34-
- v1.2.1 (1/12/2025) :
34+
- v1.2.1 (2/12/2025) :
3535
- Separated changelog from header
3636
37-
- v1.2.2 (1/12/2025) :
37+
- v1.2.2 (2/12/2025) :
3838
- Added description and instructions in js file
3939
- Bug fixes
4040
- First version in gallery
4141
42+
- v1.2.3 (3/26/2025) :
43+
- Fixed dates in changelog
44+
- Fixed tons of errors that only occur when playing on sprig (not in editor)
4245
*/
4346

4447
// define the sprites in our game
@@ -60,7 +63,8 @@ var endless = false;
6063
var runid = 0;
6164
var menuTextId = 0;
6265
var wallStep = 0;
63-
const winStep = 175;
66+
let i = 0;
67+
const winStep = 15;
6468
const tickSpeed = 500;
6569
const wallDist = 3;
6670

@@ -453,12 +457,12 @@ function select() {
453457
}
454458
inMenu = false;
455459
clearText()
456-
addText("Press I to", {y: 2})
457-
addText("return to menu", {y: 3})
460+
addText("Press I to", {y: 3})
461+
addText("return to menu", {y: 4})
458462

459463
menuTextId = setTimeout(function () {
460464
clearText();
461-
addText(wallStep.toString(), { y: 1, color: color`0` });
465+
addText(wallStep.toString(), { y: 2, color: color`0` });
462466
}, 2500)
463467

464468
// set the map displayed to the current level
@@ -479,9 +483,9 @@ function menu() {
479483
paused = true;
480484
wallStep = 0;
481485
setMap(levels[1]);
482-
addText("Use L to select", {y: 1, color: color`0`});
483-
addText("Normal", {y: 4, color: color`0`});
484-
addText("Endless", {y: 11, color: color`0`});
486+
addText("Use L to select", {y: 2, color: color`0`});
487+
addText("Normal", {y: 6, color: color`0`});
488+
addText("Endless", {y: 10, color: color`0`});
485489
}
486490

487491
menu()
@@ -562,8 +566,8 @@ function checkPlayer() {
562566
if (getFirst(player).x == 0) {
563567
dead = true
564568
addText("You Lose!", { y: 4, color: color`3` })
565-
x = getFirst(player).x
566-
y = getFirst(player).y
569+
var x = getFirst(player).x
570+
var y = getFirst(player).y
567571
getFirst(player).remove()
568572
getTile(x, y)[0].remove()
569573
addSprite(x, y, crocodile[2])
@@ -575,12 +579,12 @@ function checkPlayer() {
575579
dead = true;
576580
getFirst(player).remove()
577581
for (i = 0; i < crocodile.length; i++) {
578-
crocs = getAll(crocodile[i])
582+
var crocs = getAll(crocodile[i])
579583
for (i = 0; i < crocs.length; i++) {
580584
crocs[i].remove()
581585
}
582586
}
583-
walls = getAll(wall)
587+
var walls = getAll(wall)
584588
for (i = 0; i < walls.length; i++) {
585589
walls[i].remove()
586590
}
@@ -596,7 +600,7 @@ afterInput(() => {
596600
});
597601

598602
function flipCroco(x, y) {
599-
sprite = getTile(x, y)[0];
603+
var sprite = getTile(x, y)[0];
600604

601605
if (sprite.type != crocodile[0] && sprite.type != crocodile[1]) {
602606
for (i = 1; i < getTile.length; i++) {
@@ -607,9 +611,9 @@ function flipCroco(x, y) {
607611
}
608612

609613
if (sprite.type == crocodile[0]) {
610-
type = 1;
614+
var type = 1;
611615
} else {
612-
type = 0;
616+
var type = 0;
613617
}
614618

615619
sprite.remove();
@@ -627,13 +631,13 @@ function run() {
627631
}
628632
}
629633

630-
addText(wallStep.toString(), { y: 1, color: color`0` });
631-
walls = getAll(wall)
634+
addText(wallStep.toString(), { y: 2, color: color`0` });
635+
let walls = getAll(wall)
632636
for (i = 0; i < walls.length; i++) {
633637
walls[i].x += -1
634638
if (walls[i].x == 0) {
635-
x = walls[i].x;
636-
y = walls[i].y;
639+
var x = walls[i].x;
640+
var y = walls[i].y;
637641
walls[i].remove();
638642
flipCroco(x, y);
639643
}
@@ -643,7 +647,7 @@ function run() {
643647
}
644648

645649
if (wallStep % wallDist == 0 && wallStep < winStep || endless && wallStep % wallDist == 0) {
646-
door = Math.floor(Math.random() * 6);
650+
var door = Math.floor(Math.random() * 6);
647651
if (getFirst(player).x == 7 && getFirst(player).y != door) {
648652
getFirst(player).x += -1;
649653
}
@@ -658,9 +662,9 @@ function run() {
658662
checkPlayer()
659663
}
660664
if (!dead && !paused) {
661-
tick = tickSpeed - (3 * Math.floor(wallStep / 2));
665+
let tick = tickSpeed - (3 * Math.floor(wallStep / 2));
662666
if (wallStep >= 200) {
663-
tick = tickSpeed - (3 * Math.floor(200 / 2));
667+
let tick = tickSpeed - (3 * Math.floor(200 / 2));
664668
}
665669
runid = setTimeout(run, tick);
666670
}

0 commit comments

Comments
 (0)