This commit is contained in:
2022-06-08 22:34:29 +01:00
parent 970858e129
commit 4e4759fb1c
17 changed files with 77 additions and 112 deletions
+8 -9
View File
@@ -157,10 +157,9 @@ pjTrack itid i pj w = pjEffTimeRange (st,et) rotateToTarget pj w
et | i == 0 = 36
| otherwise = 40 - (i * 20)
st = et - 100
pjpos = _pjPos pj
rotateToTarget _ = fromMaybe id $ do
tpos <- w ^? itPoint . itTargeting . tgPos . _Just
return $ props . ix (_pjID pj) . pjSpin .~ turnToAmount 0.15 pjpos tpos (argV $ _pjAcc pj)
return $ props . ix (_pjID pj) . pjSpin .~ turnToAmount 0.15 (_prPos pj) tpos (argV $ _pjAcc pj)
itPoint = pointToItem $ _itemPositions w IM.! itid
doThrust :: Prop -> World -> World
@@ -173,7 +172,7 @@ doThrust pj w = w
where
accel = _pjAcc pj
i = _pjID pj
oldPos = _pjPos pj
oldPos = _prPos pj
vel = _pjVel pj
newPos = oldPos +.+ vel
(frict,g) = randomR (0.6,0.9) $ _randGen w
@@ -209,7 +208,7 @@ moveShell pj w
& stopSoundFrom (ShellSound i)
& props %~ IM.delete i
i = _pjID pj
oldPos = _pjPos pj
oldPos = _prPos pj
vel = _pjVel pj
newPos = oldPos +.+ vel
@@ -219,7 +218,7 @@ reduceSpinBy x pj = props . ix (_pjID pj) . pjSpin *~ x
drawShell :: Prop -> SPic
drawShell pj = noPic
. translateSHz 18
. uncurryV translateSHf (_pjPos pj)
. uncurryV translateSHf (_prPos pj)
$ rotateSH (argV $ _pjAcc pj) shellShape
shellShape :: Shape
@@ -239,7 +238,7 @@ drawRemoteShell pj
col | t > (-99) = green
| otherwise = red
t = _pjTimer pj
doposition = translateSPz 18 . uncurryV translateSPf (_pjPos pj) . rotateSP (_pjDir pj)
doposition = translateSPz 18 . uncurryV translateSPf (_prPos pj) . rotateSP (_pjDir pj)
pjEffTimeRange
:: (Int,Int)
@@ -319,7 +318,7 @@ moveRemoteShell cid itid pj w
where
time = _pjTimer pj
i = _pjID pj
oldPos = _pjPos pj
oldPos = _prPos pj
vel = _pjVel pj
newPos = oldPos +.+ vel
newdir
@@ -351,7 +350,7 @@ explodeRemoteRocket itid pjid w = w
& props . ix pjid . prDraw .~ const mempty
& itPoint . itUse . rUse .~ (\_ _ -> id)
-- & itPoint . itName .~ "REMOTELAUNCHER"
& _pjPayload thepj (_pjPos thepj)
& _pjPayload thepj (_prPos thepj)
where
itPoint = pointToItem $ _itemPositions w IM.! itid
thepj = _props w IM.! pjid
@@ -373,7 +372,7 @@ fireTrackingShell it cr w = addTrackRocket w'
makeShell :: Item -> Creature -> (Prop -> World -> World) -> World -> World
makeShell it cr theupdate w = w & props %~ IM.insert i Shell
{ _pjPos = pos
{ _prPos = pos
, _pjZ = 20
, _pjStartPos = pos
, _pjVel = rotateV dir (V2 1 0)