diff options
author | Joris Guyonvarch | 2014-09-02 21:35:58 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2014-09-02 21:35:58 +0200 |
commit | c4ae3b0ee4bd338995cfecf34e0aeb49f05fa70e (patch) | |
tree | 71530e9e2cfcbe888cb086593ea1e4d0bcc269a6 /src/Enemy.elm |
Initial commit
Diffstat (limited to 'src/Enemy.elm')
-rw-r--r-- | src/Enemy.elm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Enemy.elm b/src/Enemy.elm new file mode 100644 index 0000000..2c80f0a --- /dev/null +++ b/src/Enemy.elm @@ -0,0 +1,27 @@ +module Enemy where + +import Vec2 (..) +import Board (boardDiagonal) + +type Enemy = + { initTime : Float + , initPos : Vec2 + , initDest : Vec2 + , move : Float -> Vec2 -> Vec2 -> Float -> Vec2 + } + +enemyMove : Enemy -> Float -> Vec2 +enemyMove enemy time = + enemy.move enemy.initTime enemy.initPos enemy.initDest time + +enemySize : Float +enemySize = 8 + +enemySpeed : Float -> Float +enemySpeed dt = dt / 25 + +enemySpawnDist : Float +enemySpawnDist = boardDiagonal * 3 / 5 + +enemyAwayDist : Float +enemyAwayDist = boardDiagonal |