Initial implementation of bezier bullet
This commit is contained in:
@@ -1425,14 +1425,11 @@ bezierControl targetp cid w = resetGun $ shootWithSound 0 (mkBezierBul startp co
|
||||
resetGun = set (creatures . ix cid . crInv . ix j . wpFire) $ bezierTarget
|
||||
|
||||
mkBezierBul :: Point2 -> Point2 -> Point2 -> Int -> World -> World
|
||||
mkBezierBul startp controlp targetp cid w = over particles' (bbul 30 :) w
|
||||
mkBezierBul startp controlp targetp cid w = over particles' (bbul :) 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))
|
||||
}
|
||||
|
||||
bbul = aCurveBulAt (Just cid) white startp controlp targetp
|
||||
(threeEff' bulHitCr' bulHitWall' bulHitFF') 5
|
||||
|
||||
fireRemoteLauncher :: Int -> World -> World
|
||||
fireRemoteLauncher cid w = setLocation $ resetFire $ resetName
|
||||
$ soundOnce (fromIntegral launcherSound)
|
||||
|
||||
@@ -231,6 +231,22 @@ aGenBulAt' maycid col pos vel hiteff width = Bul'
|
||||
, _btTrail' = [pos]
|
||||
, _btPassThrough' = maycid
|
||||
, _btWidth' = width
|
||||
, _btTimer' = 90
|
||||
, _btTimer' = 100
|
||||
, _btHitEffect' = hiteff
|
||||
}
|
||||
|
||||
aCurveBulAt :: Maybe Int -> Color -> Point2 -> Point2 -> Point2 -> HitEffect' -> Float -> Particle'
|
||||
aCurveBulAt maycid col pos control targ hiteff width = Bul'
|
||||
{ _ptPict' = blank
|
||||
, _ptUpdate' = mvBulletTrajectory f
|
||||
, _btVel' = (0,0)
|
||||
, _btColor' = col
|
||||
, _btTrail' = [pos]
|
||||
, _btPassThrough' = maycid
|
||||
, _btWidth' = width
|
||||
, _btTimer' = 100
|
||||
, _btHitEffect' = hiteff
|
||||
}
|
||||
where f i = g $ (100 - fromIntegral i) / 10
|
||||
g x = map (bf . (+ x)) [0,0.01..0.09]
|
||||
bf = bQuadToF (pos,control,targ)
|
||||
|
||||
Reference in New Issue
Block a user