Add crab crit, rethink Action datatype slightly
This commit is contained in:
@@ -9,6 +9,7 @@ module Dodge.Creature.Picture (
|
||||
deadFeet,
|
||||
drawChaseCrit,
|
||||
drawHoverCrit,
|
||||
drawCrabCrit,
|
||||
) where
|
||||
|
||||
import Dodge.Base.Collide
|
||||
@@ -65,6 +66,14 @@ drawHoverCrit cr = colorSH (_skinHead cskin)
|
||||
f a = tpq `Q.comp` (1 & _xy .~ rotateV a 5, Q.qid)
|
||||
tpq = (V3 0 0 0, Q.qid)
|
||||
|
||||
drawCrabCrit :: World -> Creature -> Shape
|
||||
drawCrabCrit w cr = mconcat
|
||||
[ crabUpperBody w cr
|
||||
, colorSH (_skinLower cskin) $ crabFeet cr
|
||||
]
|
||||
where
|
||||
cskin = crShape $ _crType cr
|
||||
|
||||
drawChaseCrit :: World -> Creature -> Shape
|
||||
drawChaseCrit w cr = mconcat
|
||||
[ chaseUpperBody w cr
|
||||
@@ -74,6 +83,16 @@ drawChaseCrit w cr = mconcat
|
||||
cskin = crShape $ _crType cr
|
||||
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
|
||||
|
||||
crabUpperBody :: World -> Creature -> Shape
|
||||
crabUpperBody _ cr = colorSH (_skinUpper cskin)
|
||||
(overPosSH (Q.apply torsoq) (upperPrismPolyHalfMI 5 $ polyCirc 4 12
|
||||
& each . _x *~ 0.6)
|
||||
)
|
||||
where
|
||||
torsoq = (V3 0 0 10,Q.qid)
|
||||
cskin = crShape $ _crType cr
|
||||
|
||||
|
||||
chaseUpperBody :: World -> Creature -> Shape
|
||||
chaseUpperBody w cr = colorSH (_skinUpper cskin)
|
||||
(overPosSH (Q.apply torsoq) (upperPrismPolyHalfMI tz $ polyCirc 3 12
|
||||
@@ -126,6 +145,20 @@ feet cr = case (cr ^? crType . strideAmount,cr ^? crType . footForward) of
|
||||
-- f i = 8 * (sLen - 2*i) / sLen
|
||||
f i = 8 * oneSmooth ((sLen - 2*i) / sLen)
|
||||
|
||||
crabFeet :: Creature -> Shape
|
||||
{-# INLINE crabFeet #-}
|
||||
crabFeet cr = case (cr ^? crType . strideAmount,cr ^? crType . footForward) of
|
||||
(Just sa,Just LeftForward) -> sh (f sa)
|
||||
(Just sa,Just RightForward) -> sh (-f sa)
|
||||
_ -> sh 0
|
||||
where
|
||||
sh x = translateSHxy x off aFoot <> translateSHxy (- x) (- off) aFoot
|
||||
aFoot = upperPrismPolyST 10 $ polyCirc 3 2
|
||||
off = 10
|
||||
sLen = strideLength cr
|
||||
-- f i = 8 * (sLen - 2*i) / sLen
|
||||
f i = 8 * oneSmooth ((sLen - 2*i) / sLen)
|
||||
|
||||
deadFeet :: Creature -> Shape
|
||||
{-# INLINE deadFeet #-}
|
||||
deadFeet = feet
|
||||
|
||||
Reference in New Issue
Block a user