Readd wall corner collisions

This commit is contained in:
2021-11-19 22:43:46 +00:00
parent 5658692ee4
commit 51d89982ed
8 changed files with 49 additions and 21 deletions
+1 -4
View File
@@ -60,12 +60,9 @@ teslaGun = defaultGun
, _itAimingRange = 0
}
teslaGunPic :: Item -> SPic
teslaGunPic _ =
( colorSH blue $
teslaGunPic _ = noPic $ colorSH blue $
upperPrismPoly 5 (rectNESW xb y xa (-y))
++ upperPrismPoly 5 (rectNESW (-xa) y (-xb) (-y))
, mempty
)
where
xa = 1
xb = 9
+8 -3
View File
@@ -9,7 +9,7 @@ import Geometry
import Picture
--import qualified IntMapHelp as IM
import Shape
--import ShapePicture
import ShapePicture
import Control.Lens
shrinkGun :: Item
@@ -31,15 +31,20 @@ shrinkGun = defaultGun
, _itLeftClickUse = Nothing
, _wpSpread = 0.05
, _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2[(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
, _itFloorPict = shrinkGunPic
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itAttachment = ItBool True
}
shrinkGunPic :: Item -> SPic
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
-- be careful changing this around; potential problems include updating the
-- creature but using the old crInvSel value
useShrinkGun :: Item -> Creature -> World -> World
useShrinkGun it cr w = if _itBool $ _itAttachment it
then tryResize 0.5 $ f False UndroppableIdentified . stripNoItems cr . dropUnselected cr
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropUnselected cr
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr
where
tryResize x g = maybe w g $ maybeSizeSelf x cr w