module Cloud where import Point (..) import Player (..) import Config (..) import Geometry (distance) type Cloud = { points : Config -> [Point] , spawn : Float , lastSpawn : Float } initCloud : Cloud initCloud = let spawn = 100 in { points config = case config of White -> [] Black -> [] , spawn = spawn , lastSpawn = -spawn } playerPointsCollision : Float -> Player -> [Point] -> Bool playerPointsCollision time player points = let collision = playerPointCollision time player in length (filter collision points) > 0 playerPointCollision : Float -> Player -> Point -> Bool playerPointCollision time player point = let pointPos = pointMove point time in (distance pointPos player.pos) < pointSize + playerSize