Add intersecting beams

This commit is contained in:
2022-04-06 11:40:22 +01:00
parent bca1236a85
commit de8da05bdf
9 changed files with 224 additions and 14 deletions
+32
View File
@@ -86,6 +86,8 @@ data World = World
, _props :: IM.IntMap Prop
, _instantParticles :: [Particle]
, _particles :: [Particle]
, _newBeams :: WorldBeams
, _beams :: WorldBeams
, _walls :: IM.IntMap Wall
, _doors :: IM.IntMap Door
, _machines :: IM.IntMap Machine
@@ -496,6 +498,33 @@ data ItEffect
,_itEffectID :: Maybe Int
}
data IntID a = IntID Int a
data WorldBeams = WorldBeams
{_blockingBeams :: [Beam]
,_lightBeams :: [Beam]
,_positronBeams :: [Beam]
,_electronBeams :: [Beam]
}
{- | Linear beams. Last only one frame.
- Can interact with one another in a limited manner
-}
data Beam = Beam
{ _bmDraw :: Beam -> Picture
, _bmPos :: Point2
, _bmDir :: Float
, _bmDamage :: Int
, _bmColor :: Color
, _bmPoints :: [Point2]
, _bmFirstPoints :: [Point2]
, _bmRange :: Float
, _bmPhaseV :: Float
, _bmType :: BeamType
}
data BeamType
= BeamCombine
{_beamCombine :: (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World}
| BeamSimple
{- Objects without ids.
Update themselves, perhaps with side effects. -}
data Particle
@@ -1136,3 +1165,6 @@ makeLenses ''TerminalLine
makeLenses ''ItemValue
makeLenses ''ScreenLayer
makeLenses ''Sensor
makeLenses ''Beam
makeLenses ''BeamType
makeLenses ''WorldBeams