Modularise and improve step cycle

This commit is contained in:
2021-06-06 18:23:52 +02:00
parent eb7c4a8067
commit edd947a857
7 changed files with 98 additions and 29 deletions
+6 -4
View File
@@ -53,15 +53,17 @@ advanceStepCounter
:: Float -- ^ Speed
-> Creature
-> Creature
advanceStepCounter speed = crStance . carriage %~ f
advanceStepCounter speed cr = cr & crStance . carriage %~ f
where
f w@Walking{} = w{_stepToAdd = ceiling speed}
f s = s
--stnce = _crStance cr
f car = case car of
Standing -> f (Walking 0 RightForward)
Walking i ff -> Walking (i + ceiling speed) ff
_ -> car
creatureTurn :: Float -> Creature -> Creature
creatureTurn a = crDir +~ a
creatureTurnTo :: Point2 -> Creature -> Creature
creatureTurnTo p cr
| vToTarg == (0,0) = cr -- this should deal with the angleVV error