Fix jetpack

This commit is contained in:
2021-04-24 20:24:33 +02:00
parent 71795d2d9d
commit 24ea24cd6d
3 changed files with 12 additions and 3 deletions
+8 -3
View File
@@ -237,7 +237,10 @@ goalPict cr = let r = _crRad cr in case _crState cr of
_ -> dGoals $ sizeColEnemy r magenta _ -> dGoals $ sizeColEnemy r magenta
where dGoals p = pictures [p, rotate (0 - _crDir cr) $ scale 0.1 0.1 $ color white $ text $ show gls] where dGoals p = pictures [p, rotate (0 - _crDir cr) $ scale 0.1 0.1 $ color white $ text $ show gls]
_ -> sizeColEnemy r (light $ dim green) _ -> sizeColEnemy r (light $ dim green)
{-
The creature you control.
ID 0.
-}
startCr :: Creature startCr :: Creature
startCr = defaultCreature startCr = defaultCreature
{ _crPos = (0,0) { _crPos = (0,0)
@@ -253,10 +256,12 @@ startCr = defaultCreature
, _crInv = startInventory , _crInv = startInventory
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ pictures [color (greyN 0.8) $ circleSolid 10, circLine 10] , _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] startInventory = IM.fromList (zip [0..20]
( (
[ jetPack [
--[pistol --[pistol
--,blinkGun --,blinkGun
--,spawnGun lamp --,spawnGun lamp
+3
View File
@@ -60,14 +60,17 @@ wasdWithAiming w speed aimSpeed i cr
= stepForward' aimSpeed = stepForward' aimSpeed
$ over crPos (+.+ (aimSpeed *.* mov)) $ over crPos (+.+ (aimSpeed *.* mov))
$ set crDir mouseDir $ set crDir mouseDir
$ set (crState . stance . carriage) (Walking 0 0)
cr cr
| isMoving | isMoving
= stepForward' speed = stepForward' speed
$ over ( crPos) (+.+ (speed *.* mov)) $ over ( crPos) (+.+ (speed *.* mov))
$ over ( crDir) (flip fromMaybe dir) $ over ( crDir) (flip fromMaybe dir)
$ set (crState . stance . carriage) (Walking 0 0)
cr cr
| otherwise | otherwise
= over ( crDir) (flip fromMaybe dir) = over ( crDir) (flip fromMaybe dir)
$ set (crState . stance . carriage) Standing
cr cr
where where
(mov',dir') = wasdComp (view keys w) w (mov',dir') = wasdComp (view keys w) w
+1
View File
@@ -232,6 +232,7 @@ data Stance = Stance
deriving (Eq,Show) deriving (Eq,Show)
data Carriage data Carriage
= Walking { _stepCycle :: Int, _stepToAdd :: Int } = Walking { _stepCycle :: Int, _stepToAdd :: Int }
| Standing
| Floating | Floating
| Boosting Point2 | Boosting Point2
deriving (Eq,Show) deriving (Eq,Show)