Debug bezier quad, doesn't draw straighter lines well

This commit is contained in:
2021-03-12 22:17:48 +01:00
parent 95c9610b74
commit 9aa6fec418
6 changed files with 25 additions and 13 deletions
+11 -3
View File
@@ -1415,16 +1415,24 @@ bezierTarget cid w = setTarget w
p = mouseWorldPos w
bezierControl :: Point2 -> Int -> World -> World
bezierControl targetp cid w = shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
bezierControl targetp cid w = resetGun $ shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
where
j = _crInvSel $ _creatures w IM.! cid
controlp = mouseWorldPos w
cr = _creatures w IM.! cid
dir = _crDir cr
startp = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
resetGun = set (creatures . ix cid . crInv . ix j . wpFire) $ bezierTarget
mkBezierBul :: Point2 -> Point2 -> Point2 -> Int -> World -> World
mkBezierBul startp controlp targetp cid w = w
mkBezierBul startp controlp targetp cid w = over particles' (bbul 30 :) w
where
bbul i = Particle'
{_ptPict' = onLayerL [levLayer PtLayer ] $ bezierQuad white white 5 5 startp controlp targetp
,_ptUpdate' = \w p -> case i of 0 -> (w, Nothing)
n -> (w, Just $ bbul (i-1))
}
fireRemoteLauncher :: Int -> World -> World
fireRemoteLauncher cid w = setLocation $ resetFire $ resetName
$ soundOnce (fromIntegral launcherSound)