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
+3 -3
View File
@@ -458,7 +458,7 @@ aTractorBeam _ cr w = w & props . at i ?~ tractorBeamAt i spos outpos dir power
tractorBeamAt :: Int -> Point2 -> Point2 -> Float -> Point2 -> Prop
tractorBeamAt i pos outpos dir power = ProjectileTimed
{ _pjPos = pos
{ _prPos = pos
, _pjStartPos = outpos
, _pjVel = d
, _prDraw = tractorSPic
@@ -480,7 +480,7 @@ updateTractor pj w
where
i = _pjID pj
pullVel = _pjVel pj
pos = _pjPos pj
pos = _prPos pj
outpos = _pjStartPos pj
tractFlIt :: Point2 -> Point2 -> Point2 -> FloorItem -> FloorItem
@@ -519,7 +519,7 @@ tractorSPic pj = (,) mempty $ setLayer BloomNoZWrite $ setDepth 20 $ color (with
]
where
size = fromIntegral (_pjTime pj)
spos = _pjPos pj
spos = _prPos pj
xpos = _pjStartPos pj
d = squashNormalizeV $ spos -.- xpos
n = vNormal d
+1 -1
View File
@@ -64,7 +64,7 @@ addBoostShockwave pjid p v w = w & props %~
where
thePJ = LinearShockwave
{ _prDraw = drawBoostShockwave
, _pjPos = p
, _prPos = p
, _pjID = pjid
, _pjUpdate = updateLinearShockwave
, _pjPoints = [(p,v)]
+1 -1
View File
@@ -60,7 +60,7 @@ aDroneWithItemParams it cr w = over props (IM.insert i theShell) w
dir = _crDir cr
--ammoMvs pj w' = foldr (\pjP -> _pjMoveParam pjP (_pjIntParam pjP) it cr pj) w' (_amPjParams am)
theShell = Drone
{ _pjPos = pos
{ _prPos = pos
, _pjStartPos = pos
, _pjVel = rotateV dir (V2 1 0)
, _prDraw = _amPjDraw $ _laType am
+15 -18
View File
@@ -51,19 +51,19 @@ moveGrenade :: Prop -> World -> World
moveGrenade pj w
| _pjTimer pj <= 0 = w
& props %~ IM.delete pID
& _pjPayload pj (_pjPos (_props w IM.! pID))
& _pjPayload pj (_prPos (_props w IM.! pID))
| otherwise = case collideCircWalls oldPos newPos 4 $ wallsNearPoint newPos w of
Nothing -> w & props . ix pID %~ normalUpdate
Just (p,v) -> w
& soundStart (Tap 0) p tapQuietS Nothing
& props . ix pID %~ ( ( pjPos .~ p ) . ( pjTimer -~ 1 ) . (pjVel .~ v) )
& props . ix pID %~ ( ( prPos .~ p ) . ( pjTimer -~ 1 ) . (pjVel .~ v) )
where
pID = _pjID pj
normalUpdate = (pjTimer -~ 1)
. (pjZ %~ (max 0 . (+ _pjVelZ pj)))
. (pjVelZ -~ 0.1)
. ( pjPos .~ newPos )
oldPos = _pjPos pj
. ( prPos .~ newPos )
oldPos = _prPos pj
newPos = _pjVel pj +.+ oldPos
grenadePic :: Int -> SPic
@@ -77,11 +77,8 @@ grenadePic time =
)
grenadeDraw :: Float -> Prop -> SPic
grenadeDraw dir prop = translateSPz z $ uncurryV translateSPf p $ rotateSP dir $ grenadePic time
where
p = _pjPos prop
time = _pjTimer prop
z = _pjZ prop
grenadeDraw dir prop = translateSPz (_pjZ prop) $ uncurryV translateSPf (_prPos prop)
$ rotateSP dir $ grenadePic $ _pjTimer prop
throwGrenade
:: (Point2 -> World -> World) -- ^ Payload
@@ -92,7 +89,7 @@ throwGrenade thePayload cr w = setWp $ removePict $ over props addG w
where
n = _crID cr
addG = IM.insert i $ Bomb
{ _pjPos = p
{ _prPos = p
, _pjZ = 10
, _pjVelZ = 2
, _pjVel = v
@@ -174,13 +171,13 @@ moveRemoteBomb itid time pID w
Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing updatedWorld
_ -> updatedWorld
where
updatedWorld
= updateV $ set (props . ix pID . pjPos) finalPos
$ updatePicture
$ set (props .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (time-1) pID)
w
updatedWorld = w
& updateV
& props . ix pID . prPos .~ finalPos
& updatePicture
& props . ix pID . pjUpdate .~ (\_ -> moveRemoteBomb itid (time-1) pID)
pj = _props w IM.! pID
oldPos = _pjPos pj
oldPos = _prPos pj
newPos = _pjVel pj +.+ oldPos
-- this is hacky, should use a version of collidePointWalls' that collides
-- circles and walls
@@ -225,7 +222,7 @@ throwRemoteBomb cr w = setLocation
where
cid = _crID cr
addG = IM.insert i $ Projectile
{ _pjPos = p
{ _prPos = p
, _pjStartPos = p
, _pjVel = v
, _prDraw = const mempty
@@ -261,7 +258,7 @@ explodeRemoteBomb itid pjid cr w
-- $ resetName
$ resetPict
-- $ resetScope
$ makeExplosionAt (_pjPos (_props w IM.! pjid)) w
$ makeExplosionAt (_prPos (_props w IM.! pjid)) w
-- - $ makeShrapnelBombAt (_pjPos (_props w IM.! pjid)) w
where
cid = _crID cr
+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)
+3 -3
View File
@@ -29,13 +29,13 @@ retireRemoteProj resetFire itid t pjid w = setScope w
& creatures . ix cid . crInv . ix invid . itScope
. scopePos .~ (pos -.- _crPos (_creatures w' IM.! cid))
_ -> w'
pos = fromMaybe (V2 0 0) $ w ^? props . ix pjid . pjPos
pos = fromMaybe (V2 0 0) $ w ^? props . ix pjid . prPos
setRemoteBombScope :: Int -> Prop -> World -> World
setRemoteBombScope itid pj w' = case _itemPositions w' IM.! itid of
InInv cid invid
-> w' & creatures . ix cid . crInv . ix invid . itScope
. scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid))
. scopePos .~ (_prPos pj -.- _crPos (_creatures w' IM.! cid))
& creatures . ix cid . crInv . ix invid . itUse . useAim . aimZoom
.~ (defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5})
_ -> w'
@@ -44,5 +44,5 @@ setRemoteScope :: Int -> Prop -> World -> World
setRemoteScope itid pj w' = case w' ^? itemPositions . ix itid of
Just (InInv cid' invid )
-> w' & creatures . ix cid' . crInv . ix invid . itScope
. scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid'))
. scopePos .~ (_prPos pj -.- _crPos (_creatures w' IM.! cid'))
_ -> w'
+1 -1
View File
@@ -8,7 +8,7 @@ import Control.Lens
decTimMvVel :: Prop -> World -> World
decTimMvVel pj = props . ix pjid %~
( (pjTimer -~ 1)
. (pjPos %~ (+.+ vel) )
. (prPos %~ (+.+ vel) )
. (pjAcc %~ rotateV rot )
)
where