From 24ea24cd6dfb9a0228b504a379f07931aa0bdbc9 Mon Sep 17 00:00:00 2001 From: jgk Date: Sat, 24 Apr 2021 20:24:33 +0200 Subject: [PATCH] Fix jetpack --- src/Dodge/Creature.hs | 11 ++++++++--- src/Dodge/Creature/YourControl.hs | 3 +++ src/Dodge/Data.hs | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Dodge/Creature.hs b/src/Dodge/Creature.hs index a40ae4650..66cb84c72 100644 --- a/src/Dodge/Creature.hs +++ b/src/Dodge/Creature.hs @@ -237,7 +237,10 @@ goalPict cr = let r = _crRad cr in case _crState cr of _ -> dGoals $ sizeColEnemy r magenta where dGoals p = pictures [p, rotate (0 - _crDir cr) $ scale 0.1 0.1 $ color white $ text $ show gls] _ -> sizeColEnemy r (light $ dim green) - +{- +The creature you control. +ID 0. +-} startCr :: Creature startCr = defaultCreature { _crPos = (0,0) @@ -253,10 +256,12 @@ startCr = defaultCreature , _crInv = startInventory , _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ pictures [color (greyN 0.8) $ circleSolid 10, circLine 10] } - +{- +Items you start with. + -} startInventory = IM.fromList (zip [0..20] ( - [ jetPack + [ --[pistol --,blinkGun --,spawnGun lamp diff --git a/src/Dodge/Creature/YourControl.hs b/src/Dodge/Creature/YourControl.hs index 02daea674..f99e144b1 100644 --- a/src/Dodge/Creature/YourControl.hs +++ b/src/Dodge/Creature/YourControl.hs @@ -60,14 +60,17 @@ wasdWithAiming w speed aimSpeed i cr = stepForward' aimSpeed $ over crPos (+.+ (aimSpeed *.* mov)) $ set crDir mouseDir + $ set (crState . stance . carriage) (Walking 0 0) cr | isMoving = stepForward' speed $ over ( crPos) (+.+ (speed *.* mov)) $ over ( crDir) (flip fromMaybe dir) + $ set (crState . stance . carriage) (Walking 0 0) cr | otherwise = over ( crDir) (flip fromMaybe dir) + $ set (crState . stance . carriage) Standing cr where (mov',dir') = wasdComp (view keys w) w diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 2874958a1..0bb2daa4c 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -232,6 +232,7 @@ data Stance = Stance deriving (Eq,Show) data Carriage = Walking { _stepCycle :: Int, _stepToAdd :: Int } + | Standing | Floating | Boosting Point2 deriving (Eq,Show)