Add file
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
module Dodge.Particle.HitEffect
|
||||
( penWalls
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Particle.Update
|
||||
import Geometry
|
||||
|
||||
import Data.Bifunctor
|
||||
type HitCreatureEffect = Particle -> Point2 -> Creature -> World -> World
|
||||
type HitWallEffect = Particle -> Point2 -> Wall -> World -> World
|
||||
|
||||
penWalls
|
||||
:: HitCreatureEffect
|
||||
-> HitWallEffect
|
||||
-> Particle
|
||||
-> [(Point2, Either Creature Wall)]
|
||||
-> World
|
||||
-> (World, Maybe Particle)
|
||||
penWalls crEff wlEff pt hitThings w = case hitThings of
|
||||
[] -> ( w, mvPt pt)
|
||||
((p,Left cr):_) -> (crEff pt p cr w, destroyAt p pt)
|
||||
((p,Right wl):hs) | _wlFireThrough wl
|
||||
-> first (wlEff pt p wl) $ penWalls crEff wlEff pt hs w
|
||||
((p,Right wl):_) -> (wlEff pt p wl w, destroyAt p pt)
|
||||
Reference in New Issue
Block a user