First implementation of quadratic bezier curve shader

This commit is contained in:
2021-03-12 15:25:07 +01:00
parent 6f1f817ed3
commit 0489a092bc
21 changed files with 372 additions and 37 deletions
+23
View File
@@ -335,6 +335,11 @@ launcher = defaultGun
, _itHammer = NoHammer
, _itEffect = NoItEffect
}
bezierGun = defaultGun
{ _itName = "B-GUN"
, _wpFire = bezierTarget
}
remoteLauncher = defaultGun
{ _itName = "ROCKO-REM"
, _itIdentity = RemoteLauncher
@@ -1402,6 +1407,24 @@ grenadePic x = pictures [ color (dark $ dark green) $ circleSolid 5
$ scale 0.05 0.05 $ color green $ text $ show $ 1 + quot x 20
]
bezierTarget :: Int -> World -> World
bezierTarget cid w = setTarget w
where
j = _crInvSel $ _creatures w IM.! cid
setTarget = set (creatures . ix cid . crInv . ix j . wpFire) $ bezierControl p
p = mouseWorldPos w
bezierControl :: Point2 -> Int -> World -> World
bezierControl targetp cid w = shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
where
controlp = mouseWorldPos w
cr = _creatures w IM.! cid
dir = _crDir cr
startp = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
mkBezierBul :: Point2 -> Point2 -> Point2 -> Int -> World -> World
mkBezierBul startp controlp targetp cid w = w
fireRemoteLauncher :: Int -> World -> World
fireRemoteLauncher cid w = setLocation $ resetFire $ resetName
$ soundOnce (fromIntegral launcherSound)