Commit 6114e474 authored by Evan Hahn's avatar Evan Hahn

Inline player definition; no need to put it in a variable

parent f4dfc0ef
......@@ -13,7 +13,6 @@
* l = last tick time
* m = player X
* n = player Y
* p = player
* q = tick function
* r = scalar relative to screen size
* s = ∆t
......@@ -65,7 +64,30 @@ onkeyup = event => {
if (event.keyCode === 39) { g = 0 }
}
p = _ => {
// Item
u = (type, itemX, itemY, me) => (
me = _ => {
[c.fillStyle, i] = y[type]
c.beginPath()
c.arc(itemX, itemY, r, 0, 7)
c.fill()
c.fillStyle = '#000'
c.fillText(i, itemX, itemY)
if (((itemX - m) ** 2 + (itemY - n) ** 2) < ((r * y[2][2]) ** 2)) {
y[type][2] += y[type][3]
y[type][4] += type === 4 ? y[type][3] : 1
e.splice(e.indexOf(me), 1)
}
}
)
// Define the list of entities, starting with a player
e = [_ => {
// y[3][2] === turn speed
k += ((g * y[3][2]) - (f * y[3][2])) * s
......@@ -94,32 +116,7 @@ p = _ => {
c.lineTo(-r * y[2][2], r * y[2][2])
c.fill()
c.setTransform(1, 0, 0, 1, 0, 0)
}
// Item
u = (type, itemX, itemY, me) => (
me = _ => {
[c.fillStyle, i] = y[type]
c.beginPath()
c.arc(itemX, itemY, r, 0, 7)
c.fill()
c.fillStyle = '#000'
c.fillText(i, itemX, itemY)
if (((itemX - m) ** 2 + (itemY - n) ** 2) < ((r * y[2][2]) ** 2)) {
y[type][2] += y[type][3]
y[type][4] += type === 4 ? y[type][3] : 1
e.splice(e.indexOf(me), 1)
}
}
)
// Define the list of entities
e = [p]
}]
// Add a new item periodically
......
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