diff options
author | Joris Guyonvarch | 2014-10-03 16:18:24 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2014-10-03 16:18:24 +0200 |
commit | a1a3dbadffaaab290a6b6bb4b61df787d3b8ffdd (patch) | |
tree | 039b6b171d9dbdc2c10101a3a5664125a4eddcbf /src/EnemyState.elm | |
parent | b3975b15a16fb22739f2d633caaeed0cb1c39ab7 (diff) |
Adding a target to catch
Diffstat (limited to 'src/EnemyState.elm')
-rw-r--r-- | src/EnemyState.elm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/EnemyState.elm b/src/EnemyState.elm index 81766bf..fed2981 100644 --- a/src/EnemyState.elm +++ b/src/EnemyState.elm @@ -18,12 +18,12 @@ initEnemyState = , lastSpawn = -spawn } -playerEnemyCollision : Float -> Player -> Enemy -> Bool -playerEnemyCollision time player enemy = - let enemyPos = enemyMove enemy time - in (distance enemyPos player.pos) < enemySize + playerSize - playerEnemiesCollision : Float -> Player -> [Enemy] -> Bool playerEnemiesCollision time player enemies = let collision = playerEnemyCollision time player in length (filter collision enemies) > 0 + +playerEnemyCollision : Float -> Player -> Enemy -> Bool +playerEnemyCollision time player enemy = + let enemyPos = enemyMove enemy time + in (distance enemyPos player.pos) < enemySize + playerSize |