Fix bullet particle spawn

This commit is contained in:
2022-04-11 15:00:42 +01:00
parent 3566cec00d
commit 67e6c4a5bd
4 changed files with 27 additions and 27 deletions
+8 -7
View File
@@ -174,28 +174,29 @@ inventoryA = IM.fromList $ zip [0..]
testInventory :: IM.IntMap Item
testInventory = IM.fromList $ zip [0..]
[ makeTypeCraftNum 9 PIPE
-- , makeModule INCENDIARYMODULE
-- , makeModule STATICMODULE
, makeModule INCENDIARYMODULE
, makeModule STATICMODULE
, makeModule CONCUSSMODULE
-- , bounceModule
, medkit 50 & itConsumption . itAmount .~ 3
-- , medkit 50 & itConsumption . itAmount .~ 3
, teleportModule
-- , makeTypeCraftNum 1 LIGHTER
, makeTypeCraftNum 15 TUBE
-- , makeTypeCraftNum 15 TUBE
-- , makeTypeCraftNum 9 TRANSFORMER
, makeTypeCraftNum 5 CREATURESENSOR
-- , makeTypeCraftNum 5 CREATURESENSOR
-- , makeTypeCraftNum 9 PRISM
-- , makeTypeCraftNum 3 DRUM
-- , makeTypeCraftNum 3 PUMP
-- , makeTypeCraftNum 3 BATTERY
-- , makeTypeCraftNum 1 MAGNET
, makeTypeCraftNum 1 TRANSMITTER
-- , makeTypeCraftNum 1 TRANSMITTER
, makeTypeCraftNum 10 HARDWARE
, makeTypeCraftNum 3 SPRING
, makeTypeCraftNum 10 CAN
-- , makeTypeCraftNum 3 TIN
, makeTypeCraftNum 3 PLANK
-- , makeTypeCraftNum 1 MOTOR
, makeTypeCraftNum 5 MICROCHIP
-- , makeTypeCraftNum 5 MICROCHIP
-- , makeTypeCraftNum 5 AIUNIT
]
stackedInventory :: IM.IntMap Item
+10 -11
View File
@@ -71,17 +71,22 @@ targetRBCreature :: Targeting
targetRBCreature = defaultTargeting
& tgUpdate .~ targetRBCreatureUp
& tgDraw .~ targetRBCreatureDraw
targetCursor :: Targeting
targetCursor = defaultTargeting
& tgUpdate .~ targetUpdateWith targetCursorUpdate
& tgDraw .~ targetSimpleDraw
targetSimpleDraw :: Int -> Item -> Creature -> Configuration -> World -> Picture
targetSimpleDraw _ it _ cfig w = fromMaybe mempty $ do
targetDraw :: (Item -> Picture) -> Int -> Item -> Creature -> Configuration -> World -> Picture
targetDraw f _ it _ cfig w = fromMaybe mempty $ do
p <- it ^? itTargeting . tgPos . _Just
return $ winScale cfig
$ setLayer FixedCoordLayer
$ color white
$ uncurryV translate (worldPosToScreen w p) activeTargetCursorPic
$ uncurryV translate (worldPosToScreen w p)
$ f it
targetSimpleDraw :: Int -> Item -> Creature -> Configuration -> World -> Picture
targetSimpleDraw = targetDraw $ const activeTargetCursorPic
targetRBCreatureUp :: Item -> Creature -> World -> Targeting -> (World, Targeting)
targetRBCreatureUp it cr w t
| not $ _itIsHeld it = (w, t
@@ -112,15 +117,9 @@ targetRBCreatureUp it cr w t
Just $ hasLOS cpos (_crPos cr) w
targetRBCreatureDraw :: Int -> Item -> Creature -> Configuration -> World -> Picture
targetRBCreatureDraw _ it _ cfig w = fromMaybe mempty $ do
p <- it ^? itTargeting . tgPos . _Just
return $ winScale cfig
$ setLayer FixedCoordLayer
$ color white
$ uncurryV translate (worldPosToScreen w p)
thepic
targetRBCreatureDraw = targetDraw thepic
where
thepic | _tgActive $ _itTargeting it = activeTargetCursorPic
thepic it | _tgActive $ _itTargeting it = activeTargetCursorPic
| otherwise = targetCursorPic
activeTargetCursorPic :: Picture
+1 -1
View File
@@ -1,4 +1,4 @@
module Dodge.Picture.SizeInvariant
module Dodge.Picture.SizeInvariant
where
import Dodge.Data
--import Dodge.Base
+8 -8
View File
@@ -115,14 +115,14 @@ moveFlame rotd w pt
+.+ (0.2 *.* vel)
incBall :: RandomGen g => Point2 -> State g Particle
incBall vel = do
incBall p = do
rot <- state $ randomR (0,3)
return PtZ
{ _ptDraw = drawFlameletZ rot
, _ptUpdate = moveFlamelet
, _ptVel = vel
, _ptVel = 0
, _ptColor = red
, _ptPos = V2 0 0
, _ptPos = p
, _ptCrIgnore = Nothing
, _ptWidth = 3
, _ptTimer = 20
@@ -131,11 +131,11 @@ incBall vel = do
}
concBall :: Point2 -> State g Particle
concBall _ = return Shockwave
concBall p = return Shockwave
{ _ptDraw = drawShockwave
, _ptUpdate = mvShockwave []
, _ptColor = white
, _ptPos = 0
, _ptPos = p
, _ptRad = 15
, _ptDam = 4
, _ptPush = 1
@@ -145,12 +145,12 @@ concBall _ = return Shockwave
aStaticBall :: Point2 -> State g Particle
aStaticBall vel = return PtZ
aStaticBall p = return PtZ
{ _ptDraw = drawStaticBall
, _ptUpdate = moveStaticBall
, _ptVel = vel
, _ptVel = 0
, _ptColor = blue
, _ptPos = 0
, _ptPos = p
, _ptCrIgnore = Nothing
, _ptWidth = 3
, _ptTimer = 20