Improve window drawing

This commit is contained in:
2025-10-28 09:58:44 +00:00
parent d6c4d3d609
commit 10503da955
9 changed files with 58 additions and 42 deletions
+12 -11
View File
@@ -2,6 +2,7 @@
--{-# OPTIONS_GHC -Wno-unused-imports #-}
module Dodge.Projectile.Update (updateProjectile) where
import Dodge.WorldEvent.Cloud
import Control.Monad
import Data.List (delete)
import Data.Maybe
@@ -126,8 +127,8 @@ tryThrust pj = fromMaybe id $ do
return $ doThrust pj x . pjRemoteSetDirection y pj
doThrust :: Projectile -> Maybe RocketSmoke -> World -> World
--doThrust pj smoke w =
doThrust pj _ w =
doThrust pj smoke w =
--doThrust pj _ w =
w
& randGen .~ g
& cWorld . lWorld . projectiles . ix i . pjVel . _xy %~ (\v -> accel + frict *^ v)
@@ -137,15 +138,15 @@ doThrust pj _ w =
(vel + rotateV (pi + sparkD) accel `v2z` 0)
3
10
-- & makeCloudAt
-- RocketSmoke
-- lifetime
-- (sp + r1 + 30 *^ signorm (sp - ep))
& makeCloudAt
RocketSmoke
lifetime
(sp + r1 + 30 *^ signorm (sp - ep))
where
-- lifetime = fst . randomR lt $ _randGen w
-- lt
-- | smoke == Just ReducedRocketSmoke = (50, 200)
-- | otherwise = (300, 500)
lifetime = fst . randomR lt $ _randGen w
lt
| smoke == Just ReducedRocketSmoke = (50, 200)
| otherwise = (300, 500)
accel = rotateV (pj ^. pjDir) (V2 3 0)
i = _pjID pj
sp = pj ^. pjPos
@@ -153,7 +154,7 @@ doThrust pj _ w =
ep = sp + vel
(frict, g) = randomR (0.6, 0.9) $ _randGen w
(sparkD, _) = randomR (-0.2, 0.2) $ _randGen w
-- r1 = addZ 0 $ randInCirc 10 & evalState $ _randGen w
r1 = addZ 0 $ randInCirc 10 & evalState $ _randGen w
doBarrelSpin :: Int -> Float -> Projectile -> World -> World
doBarrelSpin cid i pj w =