2.2.5 Cycle 5 - Grunts
Design:
Objectives
Usability Features
Key Variables
Variable Name
Use
Pseudocode
// Grunts
// Custom component controlling enemy patrol movement
function patrol(speed = 60, dir = 1):
return {
id: "patrol",
require: [ "pos", "area" ],
add():
this.on("collide", (obj, col) =>
if (col.isLeft() or col.isRight()):
dir = -dir
end if
)
end add
update():
this.move(speed * dir, 0)
end update
}
end function
// DEATH and DANGER
// Grunts
player.onCollide("enemy", (e, col) =>
// if it's not from the top, die
if (not col.isBottom()):
go("lose")
alert("You died! Please try again!")
// Refresh the page
if (player.pos.y > FALL_DEATH):
window.location.reload()
else:
window.location.href = "https://a-level-project.adamcleave.repl.co"
end if
end if
end function
Development:
Outcome
Challenges
Testing:
Tests
Test
Instructions
What I expect
What actually happens
Pass/Fail
Evidence
Last updated