Commit c296718a authored by Evan Hahn's avatar Evan Hahn

WIP

parent b364cdea
......@@ -7,6 +7,7 @@
* e = array of entities (q is a method called on every tick)
* f = pressing Left?
* g = pressing Right?
* h = pressing Stop?
* l = last tick time
* p = player
* q = tick function
......@@ -24,12 +25,14 @@ r = Math.min(a.width, a.height) / 30
// The player
p = ((playerX, playerY, playerVelocity, playerAcceleration, playerDirection) => {
f = g = 0
f = g = h = 0
onkeydown = event => {
if (event.keyCode === 32) { h = 1 }
if (event.keyCode === 65) { f = 1 }
if (event.keyCode === 68) { g = 1 }
}
onkeyup = event => {
if (event.keyCode === 32) { h = 0 }
if (event.keyCode === 65) { f = 0 }
if (event.keyCode === 68) { g = 0 }
}
......@@ -45,7 +48,7 @@ p = ((playerX, playerY, playerVelocity, playerAcceleration, playerDirection) =>
if (playerX < 0) { playerX += a.width }
if (playerY < 0) { playerY += a.height }
playerX = playerX % a.width
playerY = playerY % a.width
playerY = playerY % a.height
// this could probably be smaller ^
c.fillStyle = '#ffff00'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment