aboutsummaryrefslogtreecommitdiff
path: root/src/Input.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2014-10-05 23:10:18 +0200
committerJoris Guyonvarch2014-10-05 23:10:32 +0200
commit4521cdf1bb5725c9d497e5fb0c03943ad03a052f (patch)
tree8b7247e9b1b2c950c7bec39548bfe860965c5126 /src/Input.elm
parentc2583cf7ff8684d1194c61ab132e23d7ccebcd51 (diff)
Adding multiple moving points to catch
Diffstat (limited to 'src/Input.elm')
-rw-r--r--src/Input.elm23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/Input.elm b/src/Input.elm
index 69e7503..1015302 100644
--- a/src/Input.elm
+++ b/src/Input.elm
@@ -16,7 +16,7 @@ getInput : Signal Input
getInput =
let dtSignal = delta
dirSignal = lift recordIntToVec2 Keyboard.arrows
- randomFloatsSignal = Random.floatList (lift (\_ -> 5) dtSignal)
+ randomFloatsSignal = Random.floatList (lift (\_ -> 6) dtSignal)
randomValuesSignal = lift floatsToRandomValues randomFloatsSignal
in sampleOn dtSignal <| Input <~ dirSignal
~ dtSignal
@@ -32,10 +32,17 @@ recordIntToVec2 {x, y} =
}
floatsToRandomValues : [Float] -> RandomValues
-floatsToRandomValues [enemyAngle, enemyX, enemyY, targetX, targetY] =
- { enemyAngle = enemyAngle
- , enemyX = enemyX
- , enemyY = enemyY
- , targetX = targetX
- , targetY = targetY
- }
+floatsToRandomValues [angle1, x1, y1, angle2, x2, y2] =
+ let greenPoint =
+ { angle = angle1
+ , x = x1
+ , y = y1
+ }
+ redPoint =
+ { angle = angle2
+ , x = x2
+ , y = y2
+ }
+ in { greenPoint = greenPoint
+ , redPoint = redPoint
+ }