Copyright | (c) plaimi 2015 |
---|---|
License | AGPL-3 |
Maintainer | blubber@plaimi.net |
Safe Haskell | None |
Language | Haskell2010 |
- data World = MkWorld {}
- addNeutral :: World -> World
- addPlayer :: World -> String -> World
- delPlayer :: World -> String -> World
- available :: World -> Entity -> Bool
- clamp :: Ord a => a -> a -> a -> a
- createWorld :: StdGen -> World
- updateVel :: Double -> Entity -> Entity
- updatePos :: Double -> World -> Entity -> Entity
- decay :: Double -> Entity -> Entity
- blubs :: World -> World
- playerBlubbers :: World -> World
- neutralBlubbers :: World -> World
- playerBlubs :: (String, Entity) -> [(String, Entity)] -> Maybe ((String, Maybe Entity), (String, Maybe Entity))
- neutralBlubs :: (String, Entity) -> [Entity] -> Maybe ((String, Entity), Entity)
- setTargetPos :: String -> Double -> Double -> World -> Map String Entity
- updateWorld :: Double -> World -> World
- handleInput :: Ord c => [(c, (Double, Double))] -> Map c String -> World -> World
Documentation
addNeutral :: World -> World Source
Try to add a NeutralBlub
to the World
, if there is room for it. But
don't try *very* hard.
addPlayer :: World -> String -> World Source
Add a PlayerBlub
belonging to the name in the passed in String
, lest
it already has a PlayerBlub
, in which case it's just ignored.
delPlayer :: World -> String -> World Source
Delete a PlayerBlub
belonging to the name in the passed in String
,
lest it doesn't exist, in which case it's just ignored.
createWorld :: StdGen -> World Source
The initial World
.
playerBlubbers :: World -> World Source
neutralBlubbers :: World -> World Source
playerBlubs :: (String, Entity) -> [(String, Entity)] -> Maybe ((String, Maybe Entity), (String, Maybe Entity)) Source
Given an Entity
of a PlayerBlub
and its id (as a String
), and
a list of other such things, let the Entity
fite
all the ones in the
passed in the list.
It keeps checking until there's a collision. At that point, it figures out
which one blubber
s which. The blubber
er grows, and the blubber
ee is
deleted. Ruthless.
If there is no collision it returns Nothing
. If there is one, it returns
a Just
with two tuples -- one for each Blub
. The survivor will be
a Just
, the other one Nothing
.
neutralBlubs :: (String, Entity) -> [Entity] -> Maybe ((String, Entity), Entity) Source
Given an Entity
of a PlayerBlub
and its id (as a String
), and
a list of NeturalBlub
s Entity
s, let the PlayerBlub
Entity
fite
all the NeutralbBlub
s in the passed in list.
It keeps checking until there's a collision. At that point, it returns the
now rather quiute big PlayerBlub
and the poor NeutralBlub
it has
blubbered. If there is no collision it just returns Nothing
.
updateWorld :: Double -> World -> World Source