Skip to content

Commit

Permalink
Update Monkey_Demolition.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanJPope committed Jul 3, 2024
1 parent 1dee7d2 commit fa58d5c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions games/Monkey_Demolition.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let isKeyDown = {}

const monkeyRight = "m"
const monkeyLeft = "l"
const monkeyAttackLeft = "8"
Expand All @@ -17,6 +17,7 @@ let brokenBuildingCount = 0
let buildingCountText = {}
let countdown = 60
let countdownInterval
let level = 0;

const clearAllTiles = () => {
for (let x = 0; x < width(); x++) {
Expand Down Expand Up @@ -204,7 +205,7 @@ LLLLLLLLLLLLL.L.
)

setSolids([monkeyRight, monkeyLeft, ground, building1, building2, monkeyAttackRight, monkeyAttackLeft])
let level = 0
level = 0
const levels = [
map`
........................
Expand Down Expand Up @@ -265,6 +266,20 @@ onInput("a", () => {
}
})

onInput("j", () => {
level = 0
brokenBuildingCount = 0
getFirst(player).type = monkeyRight
player = monkeyRight
isFacingRight = true
clearText()
buildingCountText = addText(`Buildings Broken: ${brokenBuildingCount}`, {
x: 0,
y: 3
})
setMap(levels[level])
})

onInput("i", () => {
if(!isWon) {
const playerSprite = getFirst(player)
Expand Down Expand Up @@ -296,4 +311,4 @@ onInput("i", () => {

afterInput(() => {
checkBrokenBuildings()
})
})

0 comments on commit fa58d5c

Please sign in to comment.