This commit is contained in:
2021-10-31 15:03:05 +00:00
parent c443cc4372
commit 74a4267393
14 changed files with 85 additions and 167 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ shootBezier targetp cr w = w & particles %~ (theBullet :)
startp
(controlp +.+ randPos)
(targetp +.+ randPos')
(destroyOnImpact bulHitCr bulHitWall bulHitFF')
(destroyOnImpact bulHitCr bulHitWall)
5
controlp = mouseWorldPos w
cid = _crID cr
+3 -3
View File
@@ -8,21 +8,21 @@ import Geometry.Data
basicBullet :: Ammo
basicBullet = BulletAmmo
{ _amString = "BULLET"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall bulHitFF'
, _amBulEff = destroyOnImpact bulHitCr bulHitWall
, _amBulWth = 2
, _amBulVel = V2 50 0
}
ltBullet :: Ammo
ltBullet = BulletAmmo
{ _amString = "LTBULLET"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall bulHitFF'
, _amBulEff = destroyOnImpact bulHitCr bulHitWall
, _amBulWth = 2
, _amBulVel = V2 40 0
}
hvBullet :: Ammo
hvBullet = BulletAmmo
{ _amString = "HVBULLET"
, _amBulEff = penWalls hvBulHitCr hvBulHitWall' bulHitFF'
, _amBulEff = penWalls hvBulHitCr hvBulHitWall'
, _amBulWth = 6
, _amBulVel = V2 80 0
}
+6 -11
View File
@@ -60,11 +60,11 @@ moveLaser phaseV pos dir w pt
xp = pos +.+ 800 *.* unitVectorAtAngle dir
(a,g) = randomR (-0.7,0.7) $ _randGen w
reflectDir wall = a + argV (reflectIn (uncurry (-.-) (_wlLine wall)) (xp -.- pos))
f :: [Wall] -> Point2 -> Point2 -> (Maybe (Point2,Either3 Creature Wall ForceField),[Point2])
f :: [Wall] -> Point2 -> Point2 -> (Maybe (Point2,Either Creature Wall),[Point2])
f seenWs x y = case find (h' seenWs) $ thingsHitExceptCrLongLine Nothing x y w of
Just (p,E3x2 wl)
Just (p,Right wl)
| _wlIsSeeThrough wl -> f' p $ f (wl:seenWs) p (h x y wl p)
| otherwise -> (Just (p,E3x2 wl), [p])
| otherwise -> (Just (p,Right wl), [p])
Just (p,obj) -> (Just (p,obj), [p])
Nothing -> (Nothing, [y])
f' p (x,ps') = (x,p:ps')
@@ -92,25 +92,20 @@ moveLaser phaseV pos dir w pt
reflectInternal = 1 < abs (phaseV * sin angleInc')
reflectExternal = 1 < abs (sin angleInc / phaseV)
h' ws (_,E3x2 wl) = not $ any (\w' -> _wlID w' == _wlID wl) ws
h' ws (_,Right wl) = not $ any (\w' -> _wlID w' == _wlID wl) ws
h' _ _ = True
(thHit, ps) = f [] pos xp
hitEffect
= case thHit of
Just (p,E3x1 cr)
Just (p,Left cr)
-> over (creatures . ix (_crID cr) . crState . crDamage) ((:) $ Lasering 19 pos p xp)
Just (p,E3x2 wl) -> createSparkCol 8 (V4 20 (-5) 0 1) (p +.+ safeNormalizeV (pos -.- p))
Just (p,Right wl) -> createSparkCol 8 (V4 20 (-5) 0 1) (p +.+ safeNormalizeV (pos -.- p))
(reflectDir wl)
_ -> id
pic = setLayer 1 $ pictures
[ setDepth 19 . color (brightX 0 0.5 yellow) $ lineOfThickness 20 (pos:ps)
, setDepth 19.5 . color (brightX 10 1 yellow) $ lineOfThickness 3 (pos:ps)
]
-- $ pictures
--[ fadeLine pos (head ps) 0.2 40 yellow
--, setLayer 1 $ color (withAlpha 0.9 white) $ vThickLine (pos:ps)
--, setLayer 1 $ color (withAlpha 0.5 yellow) $ vvThickLine (pos:ps)
--]
fadeLine :: Point2 -> Point2 -> Float -> Float -> Color -> Picture
fadeLine sp ep alph width col = setLayer 1 $ polygonCol