This commit is contained in:
2021-11-25 01:14:14 +00:00
parent 5b7d9fccf1
commit 0e87f340b4
2 changed files with 34 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
module Dodge.Placement.Shift
( shiftPlacement
, shiftPSBy
) where
import Dodge.LevelGen.Data
import Dodge.ShiftPoint
import Geometry
import Control.Lens
shiftPSBy :: (Point2,Float) -> PlacementSpot -> PlacementSpot
shiftPSBy (pos,rot) ps = ps
& psPos %~ shiftPointBy (pos,rot)
& psRot %~ (+ rot)
shiftPlacement :: (Point2,Float) -> Placement -> Placement
shiftPlacement shift plmnt = case plmnt of
Placement {} -> plmnt & plSpot %~ shiftPSBy shift
& plIDCont %~ fmap (fmap $ shiftPlacement shift)
PlacementUsingPos p f -> PlacementUsingPos (shiftPoint3By shift p)
(fmap (shiftPlacement shift) f)
RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl