Add basic booster
This commit is contained in:
@@ -19,7 +19,7 @@ hasLOS p1 p2 w = not $ pointHitsWalls p1 p2 $ wallsAlongLine p1 p2 w
|
|||||||
reflectPointWalls :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe (Point2,Point2)
|
reflectPointWalls :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe (Point2,Point2)
|
||||||
reflectPointWalls p1 p2 ws
|
reflectPointWalls p1 p2 ws
|
||||||
= listToMaybe
|
= listToMaybe
|
||||||
. sortOn f
|
. sortOn (dist p1 . fst)
|
||||||
. IM.elems
|
. IM.elems
|
||||||
$ IM.mapMaybe
|
$ IM.mapMaybe
|
||||||
(( \(x,y) ->
|
(( \(x,y) ->
|
||||||
@@ -29,8 +29,6 @@ reflectPointWalls p1 p2 ws
|
|||||||
(intersectSegSeg' p1 p2 x y)
|
(intersectSegSeg' p1 p2 x y)
|
||||||
)
|
)
|
||||||
. _wlLine) ws
|
. _wlLine) ws
|
||||||
where
|
|
||||||
f (a,_) = magV (p1 -.- a)
|
|
||||||
-- | Looks for first collision of a point with walls.
|
-- | Looks for first collision of a point with walls.
|
||||||
-- If found, gives point and reflection velocity, reflection damped in normal.
|
-- If found, gives point and reflection velocity, reflection damped in normal.
|
||||||
reflectPointWallsDamped
|
reflectPointWallsDamped
|
||||||
@@ -41,7 +39,7 @@ reflectPointWallsDamped
|
|||||||
-> Maybe (Point2,Point2)
|
-> Maybe (Point2,Point2)
|
||||||
reflectPointWallsDamped dfact p1 p2 ws
|
reflectPointWallsDamped dfact p1 p2 ws
|
||||||
= listToMaybe
|
= listToMaybe
|
||||||
. sortOn f
|
. sortOn (dist p1 . fst)
|
||||||
. IM.elems
|
. IM.elems
|
||||||
$ IM.mapMaybe
|
$ IM.mapMaybe
|
||||||
(( \(x,y) -> fmap ((, reflectInParam dfact (x -.- y) (p2 -.- p1))
|
(( \(x,y) -> fmap ((, reflectInParam dfact (x -.- y) (p2 -.- p1))
|
||||||
@@ -49,8 +47,6 @@ reflectPointWallsDamped dfact p1 p2 ws
|
|||||||
(intersectSegSeg' p1 p2 x y))
|
(intersectSegSeg' p1 p2 x y))
|
||||||
. _wlLine
|
. _wlLine
|
||||||
) ws
|
) ws
|
||||||
where
|
|
||||||
f (a,_) = magV (p1 -.- a)
|
|
||||||
-- | Test if a point collides with walls
|
-- | Test if a point collides with walls
|
||||||
pointHitsWalls :: Point2 -> Point2 -> IM.IntMap Wall -> Bool
|
pointHitsWalls :: Point2 -> Point2 -> IM.IntMap Wall -> Bool
|
||||||
pointHitsWalls p1 p2
|
pointHitsWalls p1 p2
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ data KeyConfigSDL = KeyConfigSDL
|
|||||||
rotateCameraMinusKey :: SDL.Scancode,
|
rotateCameraMinusKey :: SDL.Scancode,
|
||||||
zoomInKey :: SDL.Scancode,
|
zoomInKey :: SDL.Scancode,
|
||||||
zoomOutKey :: SDL.Scancode,
|
zoomOutKey :: SDL.Scancode,
|
||||||
newKey :: SDL.Scancode
|
newMapKey :: SDL.Scancode
|
||||||
}
|
}
|
||||||
deriving (Generic, Show)
|
deriving (Generic, Show)
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ defaultKeyConfigSDL =
|
|||||||
rotateCameraMinusKey = SDL.ScancodeE,
|
rotateCameraMinusKey = SDL.ScancodeE,
|
||||||
zoomInKey = SDL.ScancodeJ,
|
zoomInKey = SDL.ScancodeJ,
|
||||||
zoomOutKey = SDL.ScancodeK,
|
zoomOutKey = SDL.ScancodeK,
|
||||||
newKey = SDL.ScancodeN
|
newMapKey = SDL.ScancodeN
|
||||||
}
|
}
|
||||||
|
|
||||||
--instance ToJSON KeyConfig where
|
--instance ToJSON KeyConfig where
|
||||||
|
|||||||
@@ -156,9 +156,10 @@ startInventory :: IM.IntMap Item
|
|||||||
startInventory = IM.fromList (zip [0..20]
|
startInventory = IM.fromList (zip [0..20]
|
||||||
(
|
(
|
||||||
[blinkGun
|
[blinkGun
|
||||||
|
,miniGun
|
||||||
,bezierGun
|
,bezierGun
|
||||||
,multGun
|
,multGun
|
||||||
,hvAutoGun
|
,boosterGun
|
||||||
,remoteLauncher
|
,remoteLauncher
|
||||||
,grenade
|
,grenade
|
||||||
,spawnGun lamp
|
,spawnGun lamp
|
||||||
|
|||||||
@@ -57,18 +57,17 @@ blinkAction
|
|||||||
:: Creature
|
:: Creature
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
blinkAction cr w
|
blinkAction cr w = soundOnce teleSound
|
||||||
= soundOnce teleSound
|
. set (creatures . ix cid . crPos) p3
|
||||||
. set (creatures . ix n . crPos) p3
|
. blinkShockwave cid p3
|
||||||
. blinkShockwave n p3
|
$ inverseShockwaveAt cpos 40 2 2 2 w
|
||||||
$ inverseShockwaveAt cp 40 2 2 2 w
|
|
||||||
where
|
where
|
||||||
n = _crID cr
|
cid = _crID cr
|
||||||
p1 = _cameraCenter w +.+ (1 / _cameraZoom w) *.* rotateV (_cameraRot w) (_mousePos w)
|
p1 = mouseWorldPos w
|
||||||
cp = _crPos $ _creatures w IM.! n
|
cpos = _crPos cr
|
||||||
p2 = reflectPointWalls cp p1 $ wallsAlongLine cp p1 w
|
p2 = reflectPointWalls cpos p1 $ wallsAlongLine cpos p1 w
|
||||||
r = 1.5 * _crRad (_creatures w IM.! n)
|
r = 1.5 * _crRad cr
|
||||||
p3 = maybe p1 ((\p -> moveAmountToward p r cp) . fst) p2
|
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
|
||||||
|
|
||||||
blinkShockwave
|
blinkShockwave
|
||||||
:: Int -- ^ Blinking creature ID.
|
:: Int -- ^ Blinking creature ID.
|
||||||
@@ -77,14 +76,6 @@ blinkShockwave
|
|||||||
-> World
|
-> World
|
||||||
blinkShockwave i p = makeShockwaveAt [i] p 60 1 2 cyan
|
blinkShockwave i p = makeShockwaveAt [i] p 60 1 2 cyan
|
||||||
|
|
||||||
moveAmountToward
|
|
||||||
:: Point2 -- ^ Start point
|
|
||||||
-> Float -- ^ Fraction to move along
|
|
||||||
-> Point2 -- ^ End point
|
|
||||||
-> Point2
|
|
||||||
moveAmountToward p1 am p2
|
|
||||||
= p1 +.+ am *.* errorNormalizeV 44 (p2 -.- p1)
|
|
||||||
|
|
||||||
{- | Get your creature to drop the item under the cursor. -}
|
{- | Get your creature to drop the item under the cursor. -}
|
||||||
youDropItem :: World -> World
|
youDropItem :: World -> World
|
||||||
youDropItem w = case yourItem w of
|
youDropItem w = case yourItem w of
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interpWith x a b = x *.* a +.+ (1 - x) *.* b
|
|||||||
|
|
||||||
invertEncircleDistP :: Float -> Creature -> Point2 -> Creature -> Point2
|
invertEncircleDistP :: Float -> Creature -> Point2 -> Creature -> Point2
|
||||||
invertEncircleDistP d tcr cenp cr = ypos +.+
|
invertEncircleDistP d tcr cenp cr = ypos +.+
|
||||||
d *.* (reflectIn (cenp -.- ypos) $ safeNormalizeV (cpos -.- cenp))
|
d *.* reflectIn (cenp -.- ypos) (safeNormalizeV (cpos -.- cenp))
|
||||||
where
|
where
|
||||||
cpos = _crPos cr
|
cpos = _crPos cr
|
||||||
ypos = _crPos tcr
|
ypos = _crPos tcr
|
||||||
@@ -226,7 +226,7 @@ flockFunc f targFunc cr = reader $ \w -> case targFunc cr w of
|
|||||||
Nothing -> cr
|
Nothing -> cr
|
||||||
Just crTarg -> cr & crActionPlan . crImpulse .~ mvPointMeleeTarg p cr crTarg
|
Just crTarg -> cr & crActionPlan . crImpulse .~ mvPointMeleeTarg p cr crTarg
|
||||||
where
|
where
|
||||||
cenp = _crGroupCenter $ _creatureGroups w IM.! (_crGroupID (_crGroup cr))
|
cenp = _crGroupCenter $ _creatureGroups w IM.! _crGroupID (_crGroup cr)
|
||||||
p = f crTarg cenp cr
|
p = f crTarg cenp cr
|
||||||
|
|
||||||
flockCenterFunc
|
flockCenterFunc
|
||||||
@@ -238,7 +238,7 @@ flockCenterFunc f targFunc cr = reader $ \w -> case targFunc cr w of
|
|||||||
Nothing -> cr
|
Nothing -> cr
|
||||||
Just crTarg -> cr & crActionPlan . crImpulse .~ mvPointMeleeTarg p cr crTarg
|
Just crTarg -> cr & crActionPlan . crImpulse .~ mvPointMeleeTarg p cr crTarg
|
||||||
where
|
where
|
||||||
cenp = _crGroupCenter $ _creatureGroups w IM.! (_crGroupID (_crGroup cr))
|
cenp = _crGroupCenter $ _creatureGroups w IM.! _crGroupID (_crGroup cr)
|
||||||
p = f crTarg cenp cr
|
p = f crTarg cenp cr
|
||||||
|
|
||||||
flockPointTargetR
|
flockPointTargetR
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import Control.Monad.Reader
|
|||||||
swarmCrit :: Creature
|
swarmCrit :: Creature
|
||||||
swarmCrit = defaultCreature
|
swarmCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
||||||
flockToPointUsing (encircleDistP (100)) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
flockToPointUsing (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
||||||
>=> return . (crMeleeCooldown . _Just %~ max 0 . subtract 1)
|
>=> return . (crMeleeCooldown . _Just %~ max 0 . subtract 1)
|
||||||
>=> basicPerceptionUpdateR [0]
|
>=> basicPerceptionUpdateR [0]
|
||||||
>=> doStrategyActionsR
|
>=> doStrategyActionsR
|
||||||
|
|||||||
+7
-1
@@ -384,7 +384,7 @@ data Projectile
|
|||||||
{ _pjPos :: Point2
|
{ _pjPos :: Point2
|
||||||
, _pjStartPos :: Point2
|
, _pjStartPos :: Point2
|
||||||
, _pjVel :: Point2
|
, _pjVel :: Point2
|
||||||
, _pjPict :: Picture
|
, _pjDraw :: Picture
|
||||||
, _pjID :: Int
|
, _pjID :: Int
|
||||||
, _pjUpdate :: World -> World
|
, _pjUpdate :: World -> World
|
||||||
}
|
}
|
||||||
@@ -397,6 +397,12 @@ data Projectile
|
|||||||
, _pjUpdate :: World -> World
|
, _pjUpdate :: World -> World
|
||||||
, _pjPayload :: Point2-> World -> World
|
, _pjPayload :: Point2-> World -> World
|
||||||
}
|
}
|
||||||
|
| BoostShockwave
|
||||||
|
{ _pjID :: Int
|
||||||
|
, _pjPict :: Picture
|
||||||
|
, _pjUpdate :: World -> World
|
||||||
|
, _pjPoints :: [Point2]
|
||||||
|
}
|
||||||
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
|
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
|
||||||
data Wall
|
data Wall
|
||||||
= Wall
|
= Wall
|
||||||
|
|||||||
+77
-107
@@ -19,6 +19,7 @@ import Dodge.Item.Weapon.TriggerType
|
|||||||
import Dodge.Item.Weapon.ExtraEffect
|
import Dodge.Item.Weapon.ExtraEffect
|
||||||
import Dodge.Item.Weapon.UseEffect
|
import Dodge.Item.Weapon.UseEffect
|
||||||
import Dodge.Item.Weapon.Laser
|
import Dodge.Item.Weapon.Laser
|
||||||
|
import Dodge.Item.Weapon.Booster
|
||||||
import Dodge.Item.Weapon.Grenade
|
import Dodge.Item.Weapon.Grenade
|
||||||
import Dodge.Item.Attachment.Data
|
import Dodge.Item.Attachment.Data
|
||||||
import Dodge.Item.Attachment
|
import Dodge.Item.Attachment
|
||||||
@@ -41,26 +42,7 @@ import System.Random
|
|||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
--import qualified Data.Map as M
|
--import qualified Data.Map as M
|
||||||
|
|
||||||
pistol
|
pistol :: Item
|
||||||
,lasGun
|
|
||||||
,tractorGun
|
|
||||||
,launcher
|
|
||||||
,ltAutoGun
|
|
||||||
,hvAutoGun
|
|
||||||
,miniGun
|
|
||||||
,teslaGun
|
|
||||||
,spreadGun
|
|
||||||
,multGun
|
|
||||||
,defaultGun
|
|
||||||
,defaultAutoGun
|
|
||||||
,rezGun
|
|
||||||
,flameLauncher
|
|
||||||
,poisonLauncher
|
|
||||||
,teslaLauncher
|
|
||||||
,remoteLauncher
|
|
||||||
,defaultThrowable
|
|
||||||
-- ,shatterGun
|
|
||||||
,longGun,flamer,blinkGun,forceFieldGun :: Item
|
|
||||||
pistol = Weapon
|
pistol = Weapon
|
||||||
{ _itName = "PISTOL"
|
{ _itName = "PISTOL"
|
||||||
, _itIdentity = Pistol
|
, _itIdentity = Pistol
|
||||||
@@ -95,8 +77,9 @@ pistol = Weapon
|
|||||||
, _itInvDisplay = basicWeaponDisplay
|
, _itInvDisplay = basicWeaponDisplay
|
||||||
, _itInvColor = white
|
, _itInvColor = white
|
||||||
}
|
}
|
||||||
|
defaultGun :: Item
|
||||||
defaultGun = pistol
|
defaultGun = pistol
|
||||||
|
defaultAutoGun :: Item
|
||||||
defaultAutoGun = autoGun
|
defaultAutoGun = autoGun
|
||||||
{ _itScrollUp = const id
|
{ _itScrollUp = const id
|
||||||
, _itScrollDown = const id
|
, _itScrollDown = const id
|
||||||
@@ -130,8 +113,6 @@ autoGun = defaultGun
|
|||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itHammer = HammerUp
|
, _itHammer = HammerUp
|
||||||
, _itFloorPict = onLayer FlItLayer $ color red $ pictures [polygon [(-4,-4),(-4,4),(4,4),(4,-4)]]
|
, _itFloorPict = onLayer FlItLayer $ color red $ pictures [polygon [(-4,-4),(-4,4),(4,4),(4,-4)]]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||||
@@ -152,7 +133,7 @@ autoGunNonTwistEff = withRecoil 40
|
|||||||
. withMuzFlare
|
. withMuzFlare
|
||||||
. withVelWthHiteff (50,0) 3
|
. withVelWthHiteff (50,0) 3
|
||||||
$ destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
$ destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||||
|
rezGun :: Item
|
||||||
rezGun = defaultGun
|
rezGun = defaultGun
|
||||||
{ _itName = "REANIMATOR"
|
{ _itName = "REANIMATOR"
|
||||||
, _wpMaxAmmo = 50
|
, _wpMaxAmmo = 50
|
||||||
@@ -168,8 +149,6 @@ rezGun = defaultGun
|
|||||||
[polygon $ rectNESW 7 3 1 (-3)
|
[polygon $ rectNESW 7 3 1 (-3)
|
||||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||||
]
|
]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color chartreuse $ pictures
|
, _itEquipPict = pictureWeaponOnAim $ color chartreuse $ pictures
|
||||||
@@ -177,6 +156,7 @@ rezGun = defaultGun
|
|||||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
teslaGun :: Item
|
||||||
teslaGun = defaultAutoGun
|
teslaGun = defaultAutoGun
|
||||||
{ _itName = "TESLA"
|
{ _itName = "TESLA"
|
||||||
, _itIdentity = TeslaGun
|
, _itIdentity = TeslaGun
|
||||||
@@ -193,8 +173,6 @@ teslaGun = defaultAutoGun
|
|||||||
[polygon $ rectNESW 7 3 1 (-3)
|
[polygon $ rectNESW 7 3 1 (-3)
|
||||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||||
]
|
]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
@@ -203,6 +181,7 @@ teslaGun = defaultAutoGun
|
|||||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
lasGun :: Item
|
||||||
lasGun = defaultAutoGun
|
lasGun = defaultAutoGun
|
||||||
{ _itName = "LASGUN ////"
|
{ _itName = "LASGUN ////"
|
||||||
, _itIdentity = LasGun
|
, _itIdentity = LasGun
|
||||||
@@ -216,8 +195,6 @@ lasGun = defaultAutoGun
|
|||||||
, _wpSpread = 0.001
|
, _wpSpread = 0.001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
, _itEquipPict = pictureWeaponOnAim $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||||
@@ -226,6 +203,7 @@ lasGun = defaultAutoGun
|
|||||||
, _itScrollDown = decCharMode
|
, _itScrollDown = decCharMode
|
||||||
, _itInvDisplay = basicWeaponDisplay
|
, _itInvDisplay = basicWeaponDisplay
|
||||||
}
|
}
|
||||||
|
forceFieldGun :: Item
|
||||||
forceFieldGun = defaultGun
|
forceFieldGun = defaultGun
|
||||||
{ _itName = "FORCEFIELD"
|
{ _itName = "FORCEFIELD"
|
||||||
, _itIdentity = ForceFieldGun
|
, _itIdentity = ForceFieldGun
|
||||||
@@ -239,8 +217,6 @@ forceFieldGun = defaultGun
|
|||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
|
, _itFloorPict = onLayer FlItLayer $ polygon [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
}
|
}
|
||||||
@@ -263,6 +239,7 @@ forceFieldGun = defaultGun
|
|||||||
-- , _itAimingSpeed = 1
|
-- , _itAimingSpeed = 1
|
||||||
-- , _itAimingRange = 0.5
|
-- , _itAimingRange = 0.5
|
||||||
-- }
|
-- }
|
||||||
|
tractorGun :: Item
|
||||||
tractorGun = defaultAutoGun
|
tractorGun = defaultAutoGun
|
||||||
{ _itName = "TRACTORGUN"
|
{ _itName = "TRACTORGUN"
|
||||||
, _itIdentity = TractorGun
|
, _itIdentity = TractorGun
|
||||||
@@ -276,12 +253,11 @@ tractorGun = defaultAutoGun
|
|||||||
, _wpSpread = 0.00001
|
, _wpSpread = 0.00001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
, _itFloorPict = onLayer FlItLayer $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
, _itEquipPict = pictureWeaponOnAim $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
||||||
}
|
}
|
||||||
|
launcher :: Item
|
||||||
launcher = defaultGun
|
launcher = defaultGun
|
||||||
{ _itName = "ROCKO"
|
{ _itName = "ROCKO"
|
||||||
, _itIdentity = Launcher
|
, _itIdentity = Launcher
|
||||||
@@ -295,24 +271,25 @@ launcher = defaultGun
|
|||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
, _itHammer = NoHammer
|
, _itHammer = NoHammer
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
}
|
}
|
||||||
|
flameLauncher :: Item
|
||||||
flameLauncher = launcher
|
flameLauncher = launcher
|
||||||
{ _itName = "FLROCKO"
|
{ _itName = "FLROCKO"
|
||||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeFlameExplosionAt
|
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeFlameExplosionAt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
poisonLauncher :: Item
|
||||||
poisonLauncher = launcher
|
poisonLauncher = launcher
|
||||||
{ _itName = "POISROCK"
|
{ _itName = "POISROCK"
|
||||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makePoisonExplosionAt
|
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makePoisonExplosionAt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
teslaLauncher :: Item
|
||||||
teslaLauncher = launcher
|
teslaLauncher = launcher
|
||||||
{ _itName = "TESLROCK"
|
{ _itName = "TESLROCK"
|
||||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeTeslaExplosionAt
|
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeTeslaExplosionAt
|
||||||
@@ -326,8 +303,6 @@ useTargetPos
|
|||||||
useTargetPos f cr w = case cr ^? crInv . ix (_crInvSel cr) . itAttachment . _Just . itTargetPos of
|
useTargetPos f cr w = case cr ^? crInv . ix (_crInvSel cr) . itAttachment . _Just . itTargetPos of
|
||||||
Nothing -> w
|
Nothing -> w
|
||||||
Just p -> f p cr w
|
Just p -> f p cr w
|
||||||
where
|
|
||||||
cid = _crID cr
|
|
||||||
|
|
||||||
bezierGun :: Item
|
bezierGun :: Item
|
||||||
bezierGun = defaultAutoGun
|
bezierGun = defaultAutoGun
|
||||||
@@ -372,7 +347,7 @@ removeItAttachment i _ w = w & creatures . ix i . crInv . ix itRef . itAttachmen
|
|||||||
where
|
where
|
||||||
cr = _creatures w IM.! i
|
cr = _creatures w IM.! i
|
||||||
itRef = _crInvSel cr
|
itRef = _crInvSel cr
|
||||||
|
remoteLauncher :: Item
|
||||||
remoteLauncher = defaultGun
|
remoteLauncher = defaultGun
|
||||||
{ _itName = "ROCKO-REM"
|
{ _itName = "ROCKO-REM"
|
||||||
, _itIdentity = RemoteLauncher
|
, _itIdentity = RemoteLauncher
|
||||||
@@ -386,13 +361,12 @@ remoteLauncher = defaultGun
|
|||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
, _itAttachment = Just $ ItScope (0,0) 0 1 True
|
, _itAttachment = Just $ ItScope (0,0) 0 1 True
|
||||||
}
|
}
|
||||||
|
hvAutoGun :: Item
|
||||||
hvAutoGun = defaultAutoGun
|
hvAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-HV"
|
{ _itName = "AUTO-HV"
|
||||||
, _itIdentity = HvAutoGun
|
, _itIdentity = HvAutoGun
|
||||||
@@ -405,8 +379,6 @@ hvAutoGun = defaultAutoGun
|
|||||||
, _itUse = rateIncAB 24 10 (torqueBeforeForced 0.1 mkHvBul) $ torqueAfter 0.2 mkHvBul
|
, _itUse = rateIncAB 24 10 (torqueBeforeForced 0.1 mkHvBul) $ torqueAfter 0.2 mkHvBul
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itEquipPict = pictureWeaponOnAim $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
@@ -417,7 +389,7 @@ hvAutoGun = defaultAutoGun
|
|||||||
. withMuzFlare
|
. withMuzFlare
|
||||||
. withVelWthHiteff (80,0) 6
|
. withVelWthHiteff (80,0) 6
|
||||||
$ penWalls hvBulHitCr' hvBulHitWall' bulHitFF'
|
$ penWalls hvBulHitCr' hvBulHitWall' bulHitFF'
|
||||||
|
ltAutoGun :: Item
|
||||||
ltAutoGun = defaultAutoGun
|
ltAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-LT"
|
{ _itName = "AUTO-LT"
|
||||||
, _itIdentity = LtAutoGun
|
, _itIdentity = LtAutoGun
|
||||||
@@ -434,8 +406,6 @@ ltAutoGun = defaultAutoGun
|
|||||||
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0
|
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0
|
||||||
,circleSolid 4
|
,circleSolid 4
|
||||||
]
|
]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
@@ -443,6 +413,7 @@ ltAutoGun = defaultAutoGun
|
|||||||
,circleSolid 4
|
,circleSolid 4
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
miniGun :: Item
|
||||||
miniGun = defaultAutoGun
|
miniGun = defaultAutoGun
|
||||||
{ _itName = "MINI-G"
|
{ _itName = "MINI-G"
|
||||||
, _itIdentity = MiniGun
|
, _itIdentity = MiniGun
|
||||||
@@ -460,12 +431,11 @@ miniGun = defaultAutoGun
|
|||||||
$ destroyOnImpact bulBounceArmCr' bulHitWall' bulHitFF'
|
$ destroyOnImpact bulBounceArmCr' bulHitWall' bulHitFF'
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
, _itEquipPict = pictureWeaponOnAim $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
||||||
}
|
}
|
||||||
|
spreadGun :: Item
|
||||||
spreadGun = defaultGun
|
spreadGun = defaultGun
|
||||||
{ _itName = "SPREAD"
|
{ _itName = "SPREAD"
|
||||||
, _itIdentity = SpreadGun
|
, _itIdentity = SpreadGun
|
||||||
@@ -482,12 +452,11 @@ spreadGun = defaultGun
|
|||||||
, _wpSpread = spreadGunSpread
|
, _wpSpread = spreadGunSpread
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [ polygon [(-3,0),(3,6),(3,-6)] ]
|
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [ polygon [(-3,0),(3,6),(3,-6)] ]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color green $ pictures [ polygon [(-3,0),(3,6),(3,-6)] ]
|
, _itEquipPict = pictureWeaponOnAim $ color green $ pictures [ polygon [(-3,0),(3,6),(3,-6)] ]
|
||||||
}
|
}
|
||||||
|
multGun :: Item
|
||||||
multGun = defaultGun
|
multGun = defaultGun
|
||||||
{ _itName = "MULTGUN"
|
{ _itName = "MULTGUN"
|
||||||
, _itIdentity = MultGun
|
, _itIdentity = MultGun
|
||||||
@@ -504,8 +473,6 @@ multGun = defaultGun
|
|||||||
, _wpSpread = spreadGunSpread
|
, _wpSpread = spreadGunSpread
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer multGunPic
|
, _itFloorPict = onLayer FlItLayer multGunPic
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||||
@@ -520,6 +487,7 @@ multGun = defaultGun
|
|||||||
, polygon $ rectNSEW (-8) (-12) 2 (-2)
|
, polygon $ rectNSEW (-8) (-12) 2 (-2)
|
||||||
, polygon [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)]
|
, polygon [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)]
|
||||||
]
|
]
|
||||||
|
longGun :: Item
|
||||||
longGun = defaultGun
|
longGun = defaultGun
|
||||||
{ _itName = "LONGGUN"
|
{ _itName = "LONGGUN"
|
||||||
, _itIdentity = LongGun
|
, _itIdentity = LongGun
|
||||||
@@ -537,8 +505,6 @@ longGun = defaultGun
|
|||||||
$ penWalls hvBulHitCr' hvBulHitWall' bulHitFF'
|
$ penWalls hvBulHitCr' hvBulHitWall' bulHitFF'
|
||||||
, _wpRange = 200
|
, _wpRange = 200
|
||||||
, _itFloorPict = onLayer FlItLayer $ pictures [color orange $ polygon $ rectNESW 3 6 (-3) (-6) ]
|
, _itFloorPict = onLayer FlItLayer $ pictures [color orange $ polygon $ rectNESW 3 6 (-3) (-6) ]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = defaultItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5}
|
||||||
@@ -570,14 +536,12 @@ poisonSprayer = defaultAutoGun
|
|||||||
, _wpSpread = 0.3
|
, _wpSpread = 0.3
|
||||||
, _wpRange = 8
|
, _wpRange = 8
|
||||||
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itEquipPict = pictureWeaponOnAim $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
}
|
}
|
||||||
|
flamer :: Item
|
||||||
flamer = defaultAutoGun
|
flamer = defaultAutoGun
|
||||||
{ _itName = "FLAMER"
|
{ _itName = "FLAMER"
|
||||||
, _itIdentity = Flamethrower
|
, _itIdentity = Flamethrower
|
||||||
@@ -587,18 +551,17 @@ flamer = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot $ withSidePush 5 $ withSidePushAfter 10 $ randWalkAngle 0.5 0.05 aFlame
|
, _itUse = shoot $ withSidePush 5 $ withSidePushAfter 10 $ randWalkAngle 0.2 0.01 aFlame
|
||||||
, _wpSpread = 0
|
, _wpSpread = 0
|
||||||
, _wpRange = 8
|
, _wpRange = 8
|
||||||
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 0.5
|
, _itAimingSpeed = 0.5
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom {_itAimZoomMax = 5, _itAimZoomMin = 1.5}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 5, _itAimZoomMin = 1.5}
|
||||||
, _itEquipPict = pictureWeaponOnAim $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itEquipPict = pictureWeaponOnAim $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
, _itAttachment = Nothing
|
, _itAttachment = Nothing
|
||||||
}
|
}
|
||||||
|
blinkGun :: Item
|
||||||
blinkGun = defaultGun
|
blinkGun = defaultGun
|
||||||
{ _itName = "BLINKER"
|
{ _itName = "BLINKER"
|
||||||
, _itIdentity = Blinker
|
, _itIdentity = Blinker
|
||||||
@@ -608,16 +571,30 @@ blinkGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot aSelf
|
, _itUse = hammerCheck $ shoot aSelf
|
||||||
|
, _wpSpread = 0.05
|
||||||
|
, _wpRange = 20
|
||||||
|
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||||
|
, _itAimingSpeed = 1
|
||||||
|
, _itAimingRange = 0
|
||||||
|
}
|
||||||
|
boosterGun :: Item
|
||||||
|
boosterGun = defaultGun
|
||||||
|
{ _itName = "BOOSTER"
|
||||||
|
, _itIdentity = Blinker
|
||||||
|
, _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
, _wpReloadTime = 20
|
||||||
|
, _wpReloadState = 0
|
||||||
|
, _itUseRate = 0
|
||||||
|
, _itUseTime = 0
|
||||||
|
, _itUse = shoot $ boostSelf Nothing 20
|
||||||
, _wpSpread = 0.05
|
, _wpSpread = 0.05
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||||
, _itAmount = 1
|
|
||||||
, _itMaxStack = 1
|
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
aTeslaArc :: Creature -> World -> World
|
aTeslaArc :: Creature -> World -> World
|
||||||
aTeslaArc cr w = aTeslaArc' cr $ soundFrom (CrWeaponSound cid) 25 1 0 w
|
aTeslaArc cr w = aTeslaArc' cr $ soundFrom (CrWeaponSound cid) 25 1 0 w
|
||||||
@@ -630,7 +607,6 @@ aTeslaArc' cr w
|
|||||||
$ over projectiles (IM.insert i (makeTeslaArcAt i pos dir))
|
$ over projectiles (IM.insert i (makeTeslaArcAt i pos dir))
|
||||||
$ set randGen g w
|
$ set randGen g w
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
|
||||||
i = newProjectileKey w
|
i = newProjectileKey w
|
||||||
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
|
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
|
||||||
+.+ sideOffset *.* vNormal (unitVectorAtAngle dir)
|
+.+ sideOffset *.* vNormal (unitVectorAtAngle dir)
|
||||||
@@ -733,15 +709,17 @@ moveShell time i cid rot accel w
|
|||||||
|
|
||||||
shellPic :: Picture
|
shellPic :: Picture
|
||||||
shellPic = color black $ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
shellPic = color black $ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||||
remoteShellPic :: Int -> Picture
|
remoteShellPic
|
||||||
remoteShellPic i
|
:: Int -- ^ Timer
|
||||||
| rem (i+200) 20 < 9 = polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
-> Picture
|
||||||
|
remoteShellPic t
|
||||||
|
| rem (t+200) 20 < 9 = polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||||
| otherwise = pictures
|
| otherwise = pictures
|
||||||
[ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
[ onLayer UPtLayer $ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||||
, color col $ circleSolid 3
|
, setLayer 1 $ onLayer HPtLayer $ color col $ circleSolid 3
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
col | i > (-99) = green
|
col | t > (-99) = green
|
||||||
| otherwise = red
|
| otherwise = red
|
||||||
|
|
||||||
shellExplosionAt :: Point2 -> World -> World
|
shellExplosionAt :: Point2 -> World -> World
|
||||||
@@ -751,23 +729,19 @@ aGasCloud :: Creature -> World -> World
|
|||||||
aGasCloud cr w = insertCloud $ set randGen g w
|
aGasCloud cr w = insertCloud $ set randGen g w
|
||||||
where
|
where
|
||||||
(a,g) = randomR (-0.1,0.1) (_randGen w)
|
(a,g) = randomR (-0.1,0.1) (_randGen w)
|
||||||
cid = _crID cr
|
|
||||||
dir = _crDir cr + a
|
dir = _crDir cr + a
|
||||||
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
||||||
--pos2 = (0.5 *.* vel) +.+
|
|
||||||
-- _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
|
||||||
vel = (_crPos cr -.- _crOldPos cr) +.+ 10 *.* unitVectorAtAngle dir
|
vel = (_crPos cr -.- _crOldPos cr) +.+ 10 *.* unitVectorAtAngle dir
|
||||||
insertCloud = makeGasCloud pos vel -- . makeFlame pos2 vel (Just cid)
|
insertCloud = makeGasCloud pos vel
|
||||||
|
|
||||||
aFlame :: Creature -> World -> World
|
aFlame :: Creature -> World -> World
|
||||||
aFlame cr w = insertFlame w
|
aFlame cr w = w & particles %~ (aFlameParticle t pos vel (Just cid) :)
|
||||||
where
|
where
|
||||||
(t,_) = randomR (99,101) (_randGen w)
|
(t,_) = randomR (99,101) (_randGen w)
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
||||||
vel = (_crPos cr -.- _crOldPos cr) +.+ 4 *.* unitVectorAtAngle dir
|
vel = (_crPos cr -.- _crOldPos cr) +.+ 4 *.* unitVectorAtAngle dir
|
||||||
insertFlame = makeFlame t pos vel (Just cid) -- . makeFlame pos2 vel (Just cid)
|
|
||||||
|
|
||||||
aSelf :: Creature -> World -> World
|
aSelf :: Creature -> World -> World
|
||||||
aSelf = blinkAction
|
aSelf = blinkAction
|
||||||
@@ -862,7 +836,7 @@ moveRemoteBomb itid time pID w
|
|||||||
(50 *.* unitVectorAtAngle (negate $ degToRad (10 * fromIntegral time)))
|
(50 *.* unitVectorAtAngle (negate $ degToRad (10 * fromIntegral time)))
|
||||||
[-0.2,-0.15,-0.1,-0.05,0,0.05,0.1,0.15,0.2]
|
[-0.2,-0.15,-0.1,-0.05,0,0.05,0.1,0.15,0.2]
|
||||||
|
|
||||||
grenade,remoteBomb :: Item
|
grenade :: Item
|
||||||
grenade = Throwable
|
grenade = Throwable
|
||||||
{ _itName = "GRENADE " ++ show fuseTime
|
{ _itName = "GRENADE " ++ show fuseTime
|
||||||
, _itIdentity = Grenade
|
, _itIdentity = Grenade
|
||||||
@@ -909,7 +883,9 @@ teslaGrenade = grenade {
|
|||||||
fuseTime = 50 :: Int
|
fuseTime = 50 :: Int
|
||||||
--f x = 50 / fromIntegral x
|
--f x = 50 / fromIntegral x
|
||||||
|
|
||||||
|
defaultThrowable :: Item
|
||||||
defaultThrowable = grenade
|
defaultThrowable = grenade
|
||||||
|
remoteBomb :: Item
|
||||||
remoteBomb = defaultThrowable
|
remoteBomb = defaultThrowable
|
||||||
{ _itName = "REMOTEBOMB"
|
{ _itName = "REMOTEBOMB"
|
||||||
, _itIdentity = RemoteBomb
|
, _itIdentity = RemoteBomb
|
||||||
@@ -923,8 +899,6 @@ remoteBomb = defaultThrowable
|
|||||||
, _itEquipPict = pictureWeaponOnAim remoteBombUnarmedPic
|
, _itEquipPict = pictureWeaponOnAim remoteBombUnarmedPic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fireRemoteLauncher :: Creature -> World -> World
|
fireRemoteLauncher :: Creature -> World -> World
|
||||||
fireRemoteLauncher cr w = setLocation
|
fireRemoteLauncher cr w = setLocation
|
||||||
$ resetFire
|
$ resetFire
|
||||||
@@ -944,11 +918,11 @@ fireRemoteLauncher cr w = setLocation
|
|||||||
, _pjID = i
|
, _pjID = i
|
||||||
, _pjUpdate = moveRemoteShell 50 i cid itid dir
|
, _pjUpdate = moveRemoteShell 50 i cid itid dir
|
||||||
}
|
}
|
||||||
j = _crInvSel $ _creatures w IM.! cid
|
j = _crInvSel cr
|
||||||
newitid = IM.newKey $ _itemPositions w
|
newitid = IM.newKey $ _itemPositions w
|
||||||
maybeitid = w ^? creatures . ix cid . crInv . ix j . itID . _Just
|
maybeitid = cr ^? crInv . ix j . itID . _Just
|
||||||
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
||||||
$ hammerCheck $ \cr -> explodeRemoteRocket itid i
|
$ hammerCheck $ \_ -> explodeRemoteRocket itid i
|
||||||
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
|
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
|
||||||
setLocation :: World -> World
|
setLocation :: World -> World
|
||||||
setLocation w' = case maybeitid of
|
setLocation w' = case maybeitid of
|
||||||
@@ -1015,7 +989,7 @@ moveRemoteShell time i cid itid _ w
|
|||||||
(frict,g) = randomR (0.6,0.9) $ _randGen w
|
(frict,g) = randomR (0.6,0.9) $ _randGen w
|
||||||
(sparkD,_) = randomR (-0.5,0.5) $ _randGen w
|
(sparkD,_) = randomR (-0.5,0.5) $ _randGen w
|
||||||
dir = argV vel
|
dir = argV vel
|
||||||
pic = onLayer PtLayer $ uncurry translate newPos
|
pic = uncurry translate newPos
|
||||||
$ rotate (argV accel) $ remoteShellPic time
|
$ rotate (argV accel) $ remoteShellPic time
|
||||||
piclow = onLayerL [levLayer CrLayer - 2]
|
piclow = onLayerL [levLayer CrLayer - 2]
|
||||||
$ uncurry translate newPos $ rotate (argV accel)
|
$ uncurry translate newPos $ rotate (argV accel)
|
||||||
@@ -1049,10 +1023,13 @@ explodeRemoteRocket itid pjid w
|
|||||||
itPoint = pointToItem $ _itemPositions w IM.! itid
|
itPoint = pointToItem $ _itemPositions w IM.! itid
|
||||||
|
|
||||||
throwRemoteBomb :: Creature -> World -> World
|
throwRemoteBomb :: Creature -> World -> World
|
||||||
throwRemoteBomb cr w = setLocation $ removePict $ resetFire
|
throwRemoteBomb cr w = setLocation
|
||||||
$ resetName $ over projectiles addG w
|
$ removePict
|
||||||
|
$ resetFire
|
||||||
|
$ resetName
|
||||||
|
$ over projectiles addG w
|
||||||
where
|
where
|
||||||
n = _crID cr -- to change to cid
|
cid = _crID cr
|
||||||
addG = IM.insert i $ Projectile
|
addG = IM.insert i $ Projectile
|
||||||
{ _pjPos = p
|
{ _pjPos = p
|
||||||
, _pjStartPos = p
|
, _pjStartPos = p
|
||||||
@@ -1062,28 +1039,22 @@ throwRemoteBomb cr w = setLocation $ removePict $ resetFire
|
|||||||
, _pjUpdate = moveRemoteBomb itid 50 i
|
, _pjUpdate = moveRemoteBomb itid 50 i
|
||||||
}
|
}
|
||||||
i = newProjectileKey w
|
i = newProjectileKey w
|
||||||
-- fireDist = zoom *.* (rotateV (_cameraRot w) (_mousePos w) +.+ _cameraCenter w -.- yourPos)
|
|
||||||
--d = argV $ _mousePos w
|
|
||||||
--(l, _) = randomR (1 - grenadeAccL,1+grenadeAccL) (_randGen w)
|
|
||||||
--(a, g) = randomR (-grenadeAccA,grenadeAccA) (_randGen w)
|
|
||||||
v' = 0.02 / _cameraZoom w *.* rotateV (_cameraRot w) ( _mousePos w)
|
v' = 0.02 / _cameraZoom w *.* rotateV (_cameraRot w) ( _mousePos w)
|
||||||
v | magV v' > 6 = 6 *.* normalizeV v'
|
v | magV v' > 6 = 6 *.* normalizeV v'
|
||||||
| otherwise = v'
|
| otherwise = v'
|
||||||
-- zoom = 1 / _cameraZoom w
|
j = _crInvSel cr
|
||||||
j = _crInvSel $ _creatures w IM.! n
|
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE"
|
||||||
resetName = set (creatures . ix n . crInv . ix j . itName) "REMOTE"
|
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> blank
|
||||||
removePict = set (creatures . ix n . crInv . ix j . itEquipPict) $ \ _ _ -> blank
|
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
||||||
resetFire = set (creatures . ix n . crInv . ix j . itUse)
|
|
||||||
$ hammerCheck $ explodeRemoteBomb itid i
|
$ hammerCheck $ explodeRemoteBomb itid i
|
||||||
cr = _creatures w IM.! n
|
|
||||||
p' = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr,0)
|
p' = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr,0)
|
||||||
p | circOnSomeWall p' 4 w = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr-4,0)
|
p | circOnSomeWall p' 4 w = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr-4,0)
|
||||||
| otherwise = p'
|
| otherwise = p'
|
||||||
maybeitid = w ^? creatures . ix n . crInv . ix j . itID . _Just
|
maybeitid = w ^? creatures . ix cid . crInv . ix j . itID . _Just
|
||||||
setLocation :: World -> World
|
setLocation :: World -> World
|
||||||
setLocation w' = case maybeitid of
|
setLocation w' = case maybeitid of
|
||||||
Nothing -> w' & creatures . ix n . crInv . ix j . itID ?~ newitid
|
Nothing -> w' & creatures . ix cid . crInv . ix j . itID ?~ newitid
|
||||||
& itemPositions %~ IM.insert newitid (InInv n j)
|
& itemPositions %~ IM.insert newitid (InInv cid j)
|
||||||
_ -> w'
|
_ -> w'
|
||||||
newitid = IM.newKey $ _itemPositions w
|
newitid = IM.newKey $ _itemPositions w
|
||||||
itid = fromMaybe newitid maybeitid
|
itid = fromMaybe newitid maybeitid
|
||||||
@@ -1092,19 +1063,19 @@ explodeRemoteBomb :: Int -> Int -> Creature -> World -> World
|
|||||||
explodeRemoteBomb itid pjid cr w
|
explodeRemoteBomb itid pjid cr w
|
||||||
= set (projectiles . ix pjid . pjUpdate) (retireRemoteBomb itid 30 pjid)
|
= set (projectiles . ix pjid . pjUpdate) (retireRemoteBomb itid 30 pjid)
|
||||||
$ set (projectiles . ix pjid . pjPict) blank
|
$ set (projectiles . ix pjid . pjPict) blank
|
||||||
$ set (creatures . ix n . crInv . ix j . itUse) (const id)
|
$ set (creatures . ix cid . crInv . ix j . itUse) (const id)
|
||||||
$ resetName
|
$ resetName
|
||||||
$ resetPict
|
$ resetPict
|
||||||
-- $ resetScope
|
-- $ resetScope
|
||||||
$ makeExplosionAt (_pjPos (_projectiles w IM.! pjid)) w
|
$ makeExplosionAt (_pjPos (_projectiles w IM.! pjid)) w
|
||||||
-- - $ makeShrapnelBombAt (_pjPos (_projectiles w IM.! pjid)) w
|
-- - $ makeShrapnelBombAt (_pjPos (_projectiles w IM.! pjid)) w
|
||||||
where
|
where
|
||||||
n = _crID cr
|
cid = _crID cr
|
||||||
resetName = set (creatures . ix n . crInv . ix j . itName) "REMOTEBOMB"
|
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEBOMB"
|
||||||
resetPict = set (creatures . ix n . crInv . ix j . itEquipPict )
|
resetPict = set (creatures . ix cid . crInv . ix j . itEquipPict )
|
||||||
(pictureWeaponOnAim remoteBombUnarmedPic)
|
(pictureWeaponOnAim remoteBombUnarmedPic)
|
||||||
-- resetScope = creatures . ix n . crInv . ix j . itScope . _Just . scopePos .~ (0,0)
|
-- resetScope = creatures . ix cid . crInv . ix j . itScope . _Just . scopePos .~ (0,0)
|
||||||
j = _crInvSel $ _creatures w IM.! n
|
j = _crInvSel $ _creatures w IM.! cid
|
||||||
remoteBombPic
|
remoteBombPic
|
||||||
:: Int -- ^ time
|
:: Int -- ^ time
|
||||||
-> Picture
|
-> Picture
|
||||||
@@ -1227,7 +1198,6 @@ spawnCrNextTo
|
|||||||
spawnCrNextTo cr sCr w = w & creatures %~ IM.insert k newCr
|
spawnCrNextTo cr sCr w = w & creatures %~ IM.insert k newCr
|
||||||
where
|
where
|
||||||
k = IM.newKey $ _creatures w
|
k = IM.newKey $ _creatures w
|
||||||
i = _crID cr
|
|
||||||
newCr = cr
|
newCr = cr
|
||||||
& crID .~ k
|
& crID .~ k
|
||||||
& crPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
|
& crPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
module Dodge.Item.Weapon.Booster
|
||||||
|
where
|
||||||
|
import Dodge.Data
|
||||||
|
import Dodge.Base
|
||||||
|
import Geometry
|
||||||
|
import IntMapHelp
|
||||||
|
|
||||||
|
import Data.Maybe
|
||||||
|
import Control.Lens
|
||||||
|
{- | Move a creature towards the mouse position, with shockwave -}
|
||||||
|
boostPoint
|
||||||
|
:: Float -- ^ boost amount
|
||||||
|
-> Creature
|
||||||
|
-> World
|
||||||
|
-> Either Point2 Point2
|
||||||
|
boostPoint x cr w = case mayp2 of
|
||||||
|
Nothing -> Right p1
|
||||||
|
Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2
|
||||||
|
where
|
||||||
|
cpos = _crPos cr
|
||||||
|
r = 1.5 * _crRad cr
|
||||||
|
p1 = cpos +.+ x *.* normalizeV (mouseWorldPos w -.- cpos)
|
||||||
|
mayp2 = reflectPointWalls cpos p1 $ wallsAlongLine cpos p1 w
|
||||||
|
|
||||||
|
boostSelf
|
||||||
|
:: Maybe Int -- ^ shockwave projectile id
|
||||||
|
-> Float -- ^ boost amount
|
||||||
|
-> Creature
|
||||||
|
-> World
|
||||||
|
-> World
|
||||||
|
boostSelf mpid x cr w = case boostPoint x cr w of
|
||||||
|
Left p -> wWithShock
|
||||||
|
& creatures . ix cid %~ ( (crPos .~ p) . (crInv . ix (_crInvSel cr) . wpLoadedAmmo .~ 1))
|
||||||
|
Right p -> wWithShock & creatures . ix cid . crPos .~ p
|
||||||
|
where
|
||||||
|
cid = _crID cr
|
||||||
|
cpos = _crPos cr
|
||||||
|
r = _crRad cr
|
||||||
|
pid = fromMaybe (newKey $ _projectiles w) mpid
|
||||||
|
wWithShock = addBoostShockwave pid cpos (vNormal $ r *.* unitVectorAtAngle (_crDir cr)) w
|
||||||
|
|
||||||
|
addBoostShockwave
|
||||||
|
:: Int
|
||||||
|
-> Point2
|
||||||
|
-> Point2
|
||||||
|
-> World
|
||||||
|
-> World
|
||||||
|
addBoostShockwave _ _ _ w = w
|
||||||
|
|
||||||
@@ -21,15 +21,14 @@ import Data.Tuple
|
|||||||
import Data.List (find)
|
import Data.List (find)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import qualified Data.Sequence as Seq
|
import qualified Data.Sequence as Seq
|
||||||
import qualified Data.IntMap.Strict as IM
|
--import qualified Data.IntMap.Strict as IM
|
||||||
|
|
||||||
aLaser :: Creature -> World -> World
|
aLaser :: Creature -> World -> World
|
||||||
aLaser cr w = over particles (makeLaserAt phaseV pos dir (Just cid) : )
|
aLaser cr w = over particles (makeLaserAt phaseV pos dir : )
|
||||||
$ soundFrom LasSound 24 1 0
|
$ soundFrom LasSound 24 1 0
|
||||||
$ laserGunFlashAt (pos +.+ 5 *.* unitVectorAtAngle dir)
|
$ laserGunFlashAt (pos +.+ 5 *.* unitVectorAtAngle dir)
|
||||||
w
|
w
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
|
||||||
pos = _crPos cr +.+ ((_crRad cr +3) *.* unitVectorAtAngle dir)
|
pos = _crPos cr +.+ ((_crRad cr +3) *.* unitVectorAtAngle dir)
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
phaseV = charToPhaseV
|
phaseV = charToPhaseV
|
||||||
@@ -42,21 +41,20 @@ charToPhaseV '/' = 1
|
|||||||
charToPhaseV 'Z' = 5
|
charToPhaseV 'Z' = 5
|
||||||
charToPhaseV _ = error "Trying to set an undefined phaseV"
|
charToPhaseV _ = error "Trying to set an undefined phaseV"
|
||||||
|
|
||||||
makeLaserAt :: Float -> Point2 -> Float -> Maybe Int -> Particle
|
makeLaserAt :: Float -> Point2 -> Float -> Particle
|
||||||
makeLaserAt phaseV pos dir mcid = Particle
|
makeLaserAt phaseV pos dir = Particle
|
||||||
{ _ptDraw = const blank
|
{ _ptDraw = const blank
|
||||||
, _ptUpdate' = moveLaser phaseV pos dir mcid
|
, _ptUpdate' = moveLaser phaseV pos dir
|
||||||
}
|
}
|
||||||
|
|
||||||
moveLaser
|
moveLaser
|
||||||
:: Float -- ^ Phase velocity, controls deflection in windows
|
:: Float -- ^ Phase velocity, controls deflection through windows
|
||||||
-> Point2
|
-> Point2
|
||||||
-> Float
|
-> Float
|
||||||
-> Maybe Int
|
|
||||||
-> World
|
-> World
|
||||||
-> Particle
|
-> Particle
|
||||||
-> (World, Maybe Particle)
|
-> (World, Maybe Particle)
|
||||||
moveLaser phaseV pos dir _ w pt
|
moveLaser phaseV pos dir w pt
|
||||||
= ( set randGen g $ hitEffect w
|
= ( set randGen g $ hitEffect w
|
||||||
, Just pt {_ptDraw = const $ onLayer PtLayer pic ,_ptUpdate' = ptTimer' 0 }
|
, Just pt {_ptDraw = const $ onLayer PtLayer pic ,_ptUpdate' = ptTimer' 0 }
|
||||||
)
|
)
|
||||||
@@ -68,14 +66,13 @@ moveLaser phaseV pos dir _ w pt
|
|||||||
f :: [Wall] -> Point2 -> Point2 -> (Maybe (Point2,Either3 Creature Wall ForceField),[Point2])
|
f :: [Wall] -> Point2 -> Point2 -> (Maybe (Point2,Either3 Creature Wall ForceField),[Point2])
|
||||||
f seenWs x y = case find (h' seenWs) $ thingsHitExceptCrLongLine Nothing x y w of
|
f seenWs x y = case find (h' seenWs) $ thingsHitExceptCrLongLine Nothing x y w of
|
||||||
Just (p,E3x2 wl)
|
Just (p,E3x2 wl)
|
||||||
| _wlIsSeeThrough wl -> f' p $ f (wl:seenWs)
|
| _wlIsSeeThrough wl -> f' p $ f (wl:seenWs) p (h x y wl p)
|
||||||
p
|
|
||||||
(h x y wl p)
|
|
||||||
| otherwise -> (Just (p,E3x2 wl), [p])
|
| otherwise -> (Just (p,E3x2 wl), [p])
|
||||||
Just (p,obj) -> (Just (p,obj), [p])
|
Just (p,obj) -> (Just (p,obj), [p])
|
||||||
Nothing -> (Nothing, [y])
|
Nothing -> (Nothing, [y])
|
||||||
f' p (x,ps') = (x,p:ps')
|
f' p (x,ps') = (x,p:ps')
|
||||||
h x y wl p | isEntering = p +.+ rotateV angleRef normalDist
|
h x y wl p
|
||||||
|
| isEntering = p +.+ rotateV angleRef normalDist
|
||||||
| otherwise = p +.+ rotateV angleRef' normalDist'
|
| otherwise = p +.+ rotateV angleRef' normalDist'
|
||||||
where
|
where
|
||||||
wlNormal = vNormal $ uncurry (-.-) $ swap (_wlLine wl)
|
wlNormal = vNormal $ uncurry (-.-) $ swap (_wlLine wl)
|
||||||
|
|||||||
@@ -52,16 +52,16 @@ rateIncAB
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
rateIncAB startRate fastRate shooteff1 shooteff2 cr w
|
rateIncAB startRate fastRate shooteff1 shooteff2 cr w
|
||||||
| repeatFire = set (pointItem . itUseRate) (max fastRate (currentRate - 1))
|
| repeatFire = w
|
||||||
$ over (pointItem . wpLoadedAmmo) (\ammo -> ammo-1)
|
& pointItem %~ ( (itUseRate .~ max fastRate (currentRate - 1))
|
||||||
$ set (pointItem . itUseTime) currentRate
|
. (wpLoadedAmmo -~ 1)
|
||||||
$ shooteff2 cr
|
. (itUseTime .~ currentRate) )
|
||||||
w
|
& shooteff2 cr
|
||||||
| firstFire = set (pointItem . itUseRate) (startRate - 1)
|
| firstFire = w
|
||||||
$ over (pointItem . wpLoadedAmmo) (\ammo -> ammo-1)
|
& pointItem %~ ( (itUseRate .~ startRate - 1)
|
||||||
$ set (pointItem . itUseTime) startRate
|
. (wpLoadedAmmo -~ 1)
|
||||||
$ shooteff1 cr
|
. (itUseTime .~ startRate) )
|
||||||
w
|
& shooteff1 cr
|
||||||
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
@@ -90,22 +90,17 @@ withWarmUp
|
|||||||
withWarmUp t f cr w
|
withWarmUp t f cr w
|
||||||
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||||
| _wpReloadState item /= 0 = w
|
| _wpReloadState item /= 0 = w
|
||||||
| fState == 0 = set (pointerToItem . itUse) (withWarmUp 100 f)
|
| fState == 0 = w
|
||||||
$ set (pointerToItem . itUseTime) 2
|
& pointerToItem %~ ( (itUse .~ withWarmUp 100 f) . (itUseTime .~ 2) )
|
||||||
w
|
| t > 2 = w
|
||||||
| t > 2 = set (pointerToItem . itUse) (withWarmUp (t-1) f)
|
& pointerToItem %~ ( (itUse .~ withWarmUp (t-1) f) . (itUseTime .~ 2) )
|
||||||
$ set (pointerToItem . itUseTime) 2
|
& soundFrom (CrWeaponSound cid) 26 2 0
|
||||||
$ soundFrom (CrWeaponSound cid) 26 2 0
|
| t > 0 = w
|
||||||
w
|
& pointerToItem %~ ( (itUse .~ withWarmUp (t-1) f) . (itUseTime .~ 2) )
|
||||||
| t > 0 = set (pointerToItem . itUse) (withWarmUp (t-1) f)
|
| otherwise = w
|
||||||
$ set (pointerToItem . itUseTime) 2
|
& pointerToItem %~ ( (itUse .~ withWarmUp 1 f) . (wpLoadedAmmo -~ 1) . (itUseTime .~ 2) )
|
||||||
w
|
& f cr
|
||||||
| otherwise = set (pointerToItem . itUse) (withWarmUp 1 f)
|
& soundFrom (CrWeaponSound cid) 28 2 0
|
||||||
$ over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
|
|
||||||
$ set (pointerToItem . itUseTime) 2
|
|
||||||
$ f cr
|
|
||||||
$ soundFrom (CrWeaponSound cid) 28 2 0
|
|
||||||
w
|
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
itRef = _crInvSel cr
|
itRef = _crInvSel cr
|
||||||
@@ -113,18 +108,14 @@ withWarmUp t f cr w
|
|||||||
pointerToItem = creatures . ix cid . crInv . ix itRef
|
pointerToItem = creatures . ix cid . crInv . ix itRef
|
||||||
fState = _itUseTime item
|
fState = _itUseTime item
|
||||||
reloadCondition = _wpLoadedAmmo item == 0
|
reloadCondition = _wpLoadedAmmo item == 0
|
||||||
{- |
|
{- | Adds a sound to a creature based world effect.
|
||||||
Adds a sound to a creature based world effect.
|
|
||||||
The sound is emitted from the creature's position. -}
|
The sound is emitted from the creature's position. -}
|
||||||
withSound
|
withSound
|
||||||
:: Int -- ^ Sound id
|
:: Int -- ^ Sound id
|
||||||
-> (Creature -> World -> World) -- ^ Underlying effect
|
-> (Creature -> World -> World) -- ^ Underlying effect
|
||||||
-> Creature
|
-> Creature
|
||||||
-> World -> World
|
-> World -> World
|
||||||
withSound soundid f cr w = (soundOncePos soundid p . f cr) w
|
withSound soundid f cr = soundOncePos soundid (_crPos cr) . f cr
|
||||||
where
|
|
||||||
cid = _crID cr
|
|
||||||
p = _crPos (_creatures w IM.! cid)
|
|
||||||
|
|
||||||
withRecoil
|
withRecoil
|
||||||
:: Float -- ^ Recoil amount
|
:: Float -- ^ Recoil amount
|
||||||
@@ -135,9 +126,8 @@ withRecoil
|
|||||||
withRecoil recoilAmount eff cr = eff cr . over (creatures . ix cid) pushback
|
withRecoil recoilAmount eff cr = eff cr . over (creatures . ix cid) pushback
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
pushback cr = over crPos (+.+ rotateV (_crDir cr) ((-recoilAmount) / _crMass cr ,0)) cr
|
pushback = over crPos (+.+ rotateV (_crDir cr) ((-recoilAmount) / _crMass cr ,0))
|
||||||
{- |
|
{- | Pushes a creature sideways by a random amount.
|
||||||
Pushes a creature sideways by a random amount.
|
|
||||||
Applied before the underlying effect. -}
|
Applied before the underlying effect. -}
|
||||||
withSidePush
|
withSidePush
|
||||||
:: Float -- ^ Maximal possible side push amount
|
:: Float -- ^ Maximal possible side push amount
|
||||||
@@ -148,10 +138,9 @@ withSidePush
|
|||||||
withSidePush maxSide eff cr w = eff cr . over (creatures . ix cid) push $ w
|
withSidePush maxSide eff cr w = eff cr . over (creatures . ix cid) push $ w
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
push cr = over crPos (+.+ rotateV (_crDir cr) (0,pushAmount / _crMass cr)) cr
|
push = over crPos (+.+ rotateV (_crDir cr) (0,pushAmount / _crMass cr))
|
||||||
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
|
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
|
||||||
{- |
|
{- | Pushes a creature sideways by a random amount.
|
||||||
Pushes a creature sideways by a random amount.
|
|
||||||
Applied after the underlying effect. -}
|
Applied after the underlying effect. -}
|
||||||
withSidePushAfter
|
withSidePushAfter
|
||||||
:: Float -- ^ Maximal possible side push amount
|
:: Float -- ^ Maximal possible side push amount
|
||||||
@@ -162,7 +151,7 @@ withSidePushAfter
|
|||||||
withSidePushAfter maxSide eff cr w = over (creatures . ix cid) push . eff cr $ w
|
withSidePushAfter maxSide eff cr w = over (creatures . ix cid) push . eff cr $ w
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
push cr = over crPos (+.+ rotateV (_crDir cr) (0,pushAmount / _crMass cr)) cr
|
push = over crPos (+.+ rotateV (_crDir cr) (0,pushAmount / _crMass cr))
|
||||||
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
|
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
|
||||||
{- |
|
{- |
|
||||||
Applies a world effect and sound effect after an ammo check. -}
|
Applies a world effect and sound effect after an ammo check. -}
|
||||||
@@ -171,7 +160,8 @@ shootWithSound
|
|||||||
-> (Creature -> World -> World)
|
-> (Creature -> World -> World)
|
||||||
-- ^ Shoot effect, takes creature id as input
|
-- ^ Shoot effect, takes creature id as input
|
||||||
-> Creature
|
-> Creature
|
||||||
-> World -> World
|
-> World
|
||||||
|
-> World
|
||||||
shootWithSound soundid f cr w
|
shootWithSound soundid f cr w
|
||||||
| fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
|
| fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
|
||||||
$ soundOncePos soundid (_crPos cr)
|
$ soundOncePos soundid (_crPos cr)
|
||||||
@@ -225,9 +215,8 @@ shoot
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
shoot f cr w
|
shoot f cr w
|
||||||
| fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
|
| fireCondition = f cr w & pointerToItem %~
|
||||||
$ set (pointerToItem . itUseTime) (_itUseRate item)
|
( (wpLoadedAmmo -~ 1) . (itUseTime .~ _itUseRate item) )
|
||||||
$ f cr w
|
|
||||||
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
@@ -247,11 +236,9 @@ withMuzFlare
|
|||||||
-> World
|
-> World
|
||||||
withMuzFlare f cr w = tempLightForAt 3 pos . muzzleFlashAt pos2 $ f cr w
|
withMuzFlare f cr w = tempLightForAt 3 pos . muzzleFlashAt pos2 $ f cr w
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
|
||||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||||
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
|
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
|
||||||
{- |
|
{- | Applies the effect to a randomly rotated creature. -}
|
||||||
Rotates the creature randomly, applies the effect, rotates the creature back. -}
|
|
||||||
withRandomDir
|
withRandomDir
|
||||||
:: Float -- ^ Max possible rotation
|
:: Float -- ^ Max possible rotation
|
||||||
-> (Creature -> World -> World)
|
-> (Creature -> World -> World)
|
||||||
@@ -259,16 +246,10 @@ withRandomDir
|
|||||||
-> Creature
|
-> Creature
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
withRandomDir acc f cr w = over (creatures . ix cid . crDir) (\d -> d - a)
|
withRandomDir acc f cr w = f (cr & crDir +~ a) $ set randGen g w
|
||||||
. f cr
|
|
||||||
. over (creatures . ix cid . crDir) (+ a)
|
|
||||||
$ set randGen g
|
|
||||||
w
|
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
|
||||||
(a, g) = randomR (-acc,acc) $ _randGen w
|
(a, g) = randomR (-acc,acc) $ _randGen w
|
||||||
{- |
|
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
|
||||||
Creates a bullet with a given velocity, width, and 'HitEffect' -}
|
|
||||||
withVelWthHiteff
|
withVelWthHiteff
|
||||||
:: Point2 -- ^ Velocity, x direction is forward with respect to the creature
|
:: Point2 -- ^ Velocity, x direction is forward with respect to the creature
|
||||||
-> Float -- ^ Bullet width
|
-> Float -- ^ Bullet width
|
||||||
@@ -276,32 +257,23 @@ withVelWthHiteff
|
|||||||
-> Creature -- ^ Creature id
|
-> Creature -- ^ Creature id
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
withVelWthHiteff vel width hiteff cr w
|
withVelWthHiteff vel width hiteff cr = over particles (newbul : )
|
||||||
= over particles (newbul : ) $ set randGen g w
|
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
newbul = aGenBulAt (Just cid) (numColor colid) pos (rotateV dir vel) hiteff width
|
newbul = aGenBulAt (Just cid) pos (rotateV dir vel) hiteff width
|
||||||
(colid, g) = randomR (0,11) $ _randGen w
|
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||||
{- |
|
{- | Apply the effect to a translated creature. -}
|
||||||
Translate the creature sideways a random amount, apply the effect, translate back. -}
|
|
||||||
withRandomOffset
|
withRandomOffset
|
||||||
:: Float -- ^ Max possible translate
|
:: Float -- ^ Max possible translate
|
||||||
-> (Creature -> World -> World)
|
-> (Creature -> World -> World)
|
||||||
-- ^ Underlying effect
|
-- ^ Underlying effect
|
||||||
-> Creature -- ^ Creature id
|
-> Creature
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
withRandomOffset offsetAmount f cr w
|
withRandomOffset offsetAmount f cr w = f (cr & crPos %~ (+.+ offV)) $ set randGen g w
|
||||||
= over (creatures . ix cid . crPos) (-.- offV)
|
|
||||||
. f cr
|
|
||||||
. over (creatures . ix cid . crPos) (+.+ offV)
|
|
||||||
$ set randGen g
|
|
||||||
w
|
|
||||||
where
|
where
|
||||||
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
|
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
|
||||||
cid = _crID cr
|
|
||||||
offV = rotateV (_crDir cr) (0,offsetVal)
|
offV = rotateV (_crDir cr) (0,offsetVal)
|
||||||
-- | Rotates a creature with minimum rotation at least 0.1.
|
-- | Rotates a creature with minimum rotation at least 0.1.
|
||||||
-- Rotates the player creature before applying the effect, other creatures after.
|
-- Rotates the player creature before applying the effect, other creatures after.
|
||||||
@@ -313,7 +285,7 @@ torqueBeforeForced
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
torqueBeforeForced torque feff cr w
|
torqueBeforeForced torque feff cr w
|
||||||
| cid == 0 = feff cr $ w
|
| cid == 0 = feff (cr & crDir +~ rot') $ w
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
& creatures . ix cid . crDir +~ rot'
|
& creatures . ix cid . crDir +~ rot'
|
||||||
& cameraRot +~ rot'
|
& cameraRot +~ rot'
|
||||||
@@ -332,7 +304,7 @@ torqueBefore
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
torqueBefore torque feff cr w
|
torqueBefore torque feff cr w
|
||||||
| cid == 0 = feff cr $ w
|
| cid == 0 = feff (cr & crDir +~ rot) $ w
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
& creatures . ix cid . crDir +~ rot
|
& creatures . ix cid . crDir +~ rot
|
||||||
& cameraRot +~ rot
|
& cameraRot +~ rot
|
||||||
@@ -369,15 +341,14 @@ spreadNumVelWthHiteff
|
|||||||
spreadNumVelWthHiteff spread num vel wth eff cr w = over particles (newbuls ++) w
|
spreadNumVelWthHiteff spread num vel wth eff cr w = over particles (newbuls ++) w
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
newbuls = zipWith3
|
newbuls = zipWith
|
||||||
(\pos d colid -> aGenBulAt (Just cid) (numColor colid) pos (rotateV d vel) eff wth)
|
(\pos d -> aGenBulAt (Just cid) pos (rotateV d vel) eff wth)
|
||||||
poss dirs colids
|
poss dirs
|
||||||
poss = map ((+.+) $ _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr))
|
poss = map ((+.+) $ _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr))
|
||||||
$ (replicateM num . randInCirc) 5 & evalState $ _randGen w
|
$ (replicateM num . randInCirc) 5 & evalState $ _randGen w
|
||||||
dirs = map (_crDir cr +) $ zipWith (+)
|
dirs = map (_crDir cr +) $ zipWith (+)
|
||||||
[-spread,-spread+(2*spread/fromIntegral num)..]
|
[-spread,-spread+(2*spread/fromIntegral num)..]
|
||||||
(randomRs (0,spread/5) (_randGen w))
|
(randomRs (0,spread/5) (_randGen w))
|
||||||
colids = take num $ randomRs (0,11) (_randGen w)
|
|
||||||
{- | Create a number of bullets side by side with a given velocity,
|
{- | Create a number of bullets side by side with a given velocity,
|
||||||
given width and given 'HitEffect'. -}
|
given width and given 'HitEffect'. -}
|
||||||
numVelWthHitEff
|
numVelWthHitEff
|
||||||
@@ -385,25 +356,19 @@ numVelWthHitEff
|
|||||||
-> Point2 -- ^ Velocity, x axis is direction of creature
|
-> Point2 -- ^ Velocity, x axis is direction of creature
|
||||||
-> Float -- ^ Bullet width
|
-> Float -- ^ Bullet width
|
||||||
-> HitEffect -- ^ Effect when hitting creature, wall etc
|
-> HitEffect -- ^ Effect when hitting creature, wall etc
|
||||||
-> Creature -- ^ Creature id
|
-> Creature
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
numVelWthHitEff num vel wth eff cr w = over particles (newbuls ++) w
|
numVelWthHitEff num vel wth eff cr = over particles (newbuls ++)
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
newbuls = zipWith
|
newbuls = map (\p -> aGenBulAt (Just cid) p (rotateV d vel) eff wth) poss
|
||||||
(\p colid -> aGenBulAt (Just cid) (numColor colid) p (rotateV d vel) eff wth)
|
|
||||||
poss
|
|
||||||
colids
|
|
||||||
d = _crDir cr
|
d = _crDir cr
|
||||||
poss = map (+.+ pos) offsets
|
poss = map (+.+ pos) $ take num offsets
|
||||||
maxOffset = fromIntegral num * 2.5 - 2.5
|
maxOffset = fromIntegral num * 2.5 - 2.5
|
||||||
offsets = map (\y -> rotateV d (0,y)) [-maxOffset,5-maxOffset..]
|
offsets = map (\y -> rotateV d (0,y)) [-maxOffset,5-maxOffset..]
|
||||||
colids = take num $ randomRs (0,11) (_randGen w)
|
|
||||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle d
|
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle d
|
||||||
|
{- | Uses '_wpSpread' as a parameter for the current offset angle. -}
|
||||||
{- |
|
|
||||||
Uses '_wpSpread' as a parameter for the current offset angle. -}
|
|
||||||
randWalkAngle
|
randWalkAngle
|
||||||
:: Float -- ^ Max offset angle
|
:: Float -- ^ Max offset angle
|
||||||
-> Float -- ^ Walk speed
|
-> Float -- ^ Walk speed
|
||||||
@@ -412,9 +377,7 @@ randWalkAngle
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
randWalkAngle ma aspeed f cr w = w
|
randWalkAngle ma aspeed f cr w = w
|
||||||
& creatures . ix cid . crDir -~ a
|
& f (cr & crDir +~ a)
|
||||||
& f cr
|
|
||||||
& creatures . ix cid . crDir +~ a
|
|
||||||
& creatures . ix cid . crInv . ix i . wpSpread .~ newa
|
& creatures . ix cid . crInv . ix i . wpSpread .~ newa
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
|
|||||||
@@ -16,21 +16,13 @@ import Geometry
|
|||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
{- |
|
{- | Creates an outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||||
Creates an outwardly increasing circle that draws creatures, even those behind walls. -}
|
|
||||||
aSonarPulse :: Creature -> World -> World
|
aSonarPulse :: Creature -> World -> World
|
||||||
aSonarPulse cr w = over particles ((:) $ sonarPulseAt (_crPos cr)) w
|
aSonarPulse cr = over particles (sonarPulseAt (_crPos cr) :)
|
||||||
|
{- | Creates an outwardly increasing circle that displays walls, even those behind other walls. -}
|
||||||
{- |
|
|
||||||
Creates an outwardly increasing circle that displays walls, even those behind other walls. -}
|
|
||||||
aRadarPulse :: Creature -> World -> World
|
aRadarPulse :: Creature -> World -> World
|
||||||
aRadarPulse cr w = over particles ((:) $ radarPulseAt (_crPos (_creatures w IM.! cid))) w
|
aRadarPulse cr = over particles (radarPulseAt (_crPos cr) :)
|
||||||
where
|
{- | Radar blip at a point. -}
|
||||||
cid = _crID cr
|
|
||||||
|
|
||||||
{- |
|
|
||||||
Radar blip at a point.
|
|
||||||
-}
|
|
||||||
blipAt :: Point2 -> Color -> Int -> Particle
|
blipAt :: Point2 -> Color -> Int -> Particle
|
||||||
blipAt p col i = Particle
|
blipAt p col i = Particle
|
||||||
{_ptDraw = const blank
|
{_ptDraw = const blank
|
||||||
@@ -42,17 +34,17 @@ mvBlip :: Point2 -> Color
|
|||||||
-> Int -- ^ Current timer value
|
-> Int -- ^ Current timer value
|
||||||
-> World -> Particle -> (World, Maybe Particle)
|
-> World -> Particle -> (World, Maybe Particle)
|
||||||
mvBlip _ _ _ 0 w _ = (w, Nothing)
|
mvBlip _ _ _ 0 w _ = (w, Nothing)
|
||||||
mvBlip p col maxt t w pt
|
mvBlip p col maxt t w pt =
|
||||||
= (w, Just $ pt & ptUpdate' .~ mvBlip p col maxt (t-1)
|
(w
|
||||||
& ptDraw .~ (const . setDepth (-0.5)
|
, Just $ pt & ptUpdate' .~ mvBlip p col maxt (t-1)
|
||||||
|
& ptDraw .~ ( const
|
||||||
|
. setDepth (-0.5)
|
||||||
. setLayer 1
|
. setLayer 1
|
||||||
$ uncurry translate p
|
. uncurry translate p
|
||||||
$ color (withAlpha (fromIntegral t / fromIntegral maxt) col)
|
. color (withAlpha (fromIntegral t / fromIntegral maxt) col)
|
||||||
$ circleSolid 2 )
|
$ circleSolid 2 )
|
||||||
)
|
)
|
||||||
|
{- | An outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||||
{- |
|
|
||||||
An outwardly increasing circle that draws creatures, even those behind walls. -}
|
|
||||||
sonarPulseAt :: Point2 -> Particle
|
sonarPulseAt :: Point2 -> Particle
|
||||||
sonarPulseAt p = Particle { _ptDraw = const blank , _ptUpdate' = mvSonar 100 p }
|
sonarPulseAt p = Particle { _ptDraw = const blank , _ptUpdate' = mvSonar 100 p }
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ brokenWalls =
|
|||||||
[((330.12192,3032.2456),(190.52365,2995.8352)),((190.52365,2995.8352),(203.94716,2945.9377)),((214.33855,2907.311),(230.12193,2859.0405)),((230.12193,2859.0405),(366.7245,2895.643)),((366.7245,2895.643),(330.12192,3032.2456)),((366.7245,2895.643),(230.12193,2859.0405)),((230.12193,2859.0405),(266.7245,2722.438)),((266.7245,2722.438),(403.32703,2759.0405)),((403.32703,2759.0405),(503.32703,2932.2456)),((466.72446,3068.8481),(330.12192,3032.2456)),((330.12192,3032.2456),(366.7245,2895.643)),((503.32703,2932.2456),(466.72446,3068.8481)),((203.94716,2945.9377),(145.99155,2930.4084)),((156.38292,2891.7817),(214.33855,2907.311)),((107.47222,2920.979),(34.06077,2901.2295)),((34.06077,2901.2295),(52.571453,2832.4224)),((70.17772,2796.55),(174.45558,2824.6025)),((174.45558,2824.6025),(156.38292,2891.7817)),((100.76944,2955.4202),(107.47222,2920.979)),((145.99155,2930.4084),(140.79587,2949.722)),((52.571453,2832.4224),(35.882084,2827.9504)),((31.745949,2785.4312),(70.17772,2796.55)),((88.14497,3002.5354),(100.76944,2955.4202)),((140.79587,2949.722),(120.21855,3027.0303)),((35.882084,2827.9504),(-22.07344,2812.4214)),((-31.039248,2768.608),(31.745949,2785.4312)),((-261.32483,3408.5737),(-303.9881,3451.237)),((-303.9881,3451.237),(-332.27234,3422.9526)),((-332.27234,3422.9526),(-289.84595,3380.5264)),((-261.56174,3352.242),(88.14497,3002.5354)),((120.21855,3027.0303),(-233.27742,3380.5264)),((-289.84595,3380.5264),(-332.2724,3338.0999)),((-332.2724,3338.0999),(-303.9881,3309.8157)),((-303.9881,3309.8157),(-261.56174,3352.242)),((-22.07344,2812.4214),(-89.68823,2794.304)),((-79.335526,2755.667),(-31.039248,2768.608)),((-210.16953,3456.4133),(-261.32483,3408.5737)),((-233.27742,3380.5264),(-194.64026,3419.1633)),((-128.32533,2783.9514),(-200.79468,3054.4106)),((-200.79468,3054.4106),(-780.35016,2899.1191)),((-780.35016,2899.1191),(-625.05865,2319.5635)),((-625.05865,2319.5635),(-45.503174,2474.855)),((-45.503174,2474.855),(-117.97253,2745.3142)),((-89.68823,2794.304),(-128.32533,2783.9514)),((-117.97253,2745.3142),(-79.335526,2755.667)),((-178.49438,3590.2566),(-241.50847,3573.372)),((-241.50847,3573.372),(-210.16953,3456.4133)),((-194.64026,3419.1633),(-136.80266,3434.6611)),((-98.165634,3445.014),(-139.85736,3600.6094)),((-92.98925,3425.6953),(-98.165634,3445.014)),((-136.80266,3434.6611),(-127.74397,3400.8535)),((-187.553,3624.064),(-178.49438,3590.2566)),((-139.85736,3600.6094),(-148.91603,3634.4167)),((-127.74397,3400.8535),(-111.20285,3339.121)),((-78.55679,3371.8325),(-92.98925,3425.6953)),((-349.5008,4383.0093),(-388.13782,4372.6563)),((-388.13782,4372.6563),(-485.18823,3653.0168)),((-485.18823,3653.0168),(-477.42368,3624.039)),((-477.42368,3624.039),(-206.96445,3696.5085)),((-168.32744,3706.861),(102.131805,3779.3306)),((102.131805,3779.3306),(94.36725,3808.308)),((94.36725,3808.308),(-349.5008,4383.0093)),((-206.96445,3696.5085),(-187.553,3624.064)),((-148.91603,3634.4167),(-168.32744,3706.861)),((299.35522,3346.2668),(97.2383,3547.9797)),((97.2383,3547.9797),(-78.55679,3371.8325)),((-111.20285,3339.121),(116.74672,3110.6904)),((116.74672,3110.6904),(320.08704,3314.438)),((352.084,3395.578),(299.35522,3346.2668)),((320.08704,3314.438),(367.6133,3358.328)),((495.06226,3666.979),(293.8115,3613.054)),((293.8115,3613.054),(352.084,3395.578)),((367.6133,3358.328),(563.6875,3410.866)),((563.6875,3410.866),(495.06226,3666.979))]
|
[((330.12192,3032.2456),(190.52365,2995.8352)),((190.52365,2995.8352),(203.94716,2945.9377)),((214.33855,2907.311),(230.12193,2859.0405)),((230.12193,2859.0405),(366.7245,2895.643)),((366.7245,2895.643),(330.12192,3032.2456)),((366.7245,2895.643),(230.12193,2859.0405)),((230.12193,2859.0405),(266.7245,2722.438)),((266.7245,2722.438),(403.32703,2759.0405)),((403.32703,2759.0405),(503.32703,2932.2456)),((466.72446,3068.8481),(330.12192,3032.2456)),((330.12192,3032.2456),(366.7245,2895.643)),((503.32703,2932.2456),(466.72446,3068.8481)),((203.94716,2945.9377),(145.99155,2930.4084)),((156.38292,2891.7817),(214.33855,2907.311)),((107.47222,2920.979),(34.06077,2901.2295)),((34.06077,2901.2295),(52.571453,2832.4224)),((70.17772,2796.55),(174.45558,2824.6025)),((174.45558,2824.6025),(156.38292,2891.7817)),((100.76944,2955.4202),(107.47222,2920.979)),((145.99155,2930.4084),(140.79587,2949.722)),((52.571453,2832.4224),(35.882084,2827.9504)),((31.745949,2785.4312),(70.17772,2796.55)),((88.14497,3002.5354),(100.76944,2955.4202)),((140.79587,2949.722),(120.21855,3027.0303)),((35.882084,2827.9504),(-22.07344,2812.4214)),((-31.039248,2768.608),(31.745949,2785.4312)),((-261.32483,3408.5737),(-303.9881,3451.237)),((-303.9881,3451.237),(-332.27234,3422.9526)),((-332.27234,3422.9526),(-289.84595,3380.5264)),((-261.56174,3352.242),(88.14497,3002.5354)),((120.21855,3027.0303),(-233.27742,3380.5264)),((-289.84595,3380.5264),(-332.2724,3338.0999)),((-332.2724,3338.0999),(-303.9881,3309.8157)),((-303.9881,3309.8157),(-261.56174,3352.242)),((-22.07344,2812.4214),(-89.68823,2794.304)),((-79.335526,2755.667),(-31.039248,2768.608)),((-210.16953,3456.4133),(-261.32483,3408.5737)),((-233.27742,3380.5264),(-194.64026,3419.1633)),((-128.32533,2783.9514),(-200.79468,3054.4106)),((-200.79468,3054.4106),(-780.35016,2899.1191)),((-780.35016,2899.1191),(-625.05865,2319.5635)),((-625.05865,2319.5635),(-45.503174,2474.855)),((-45.503174,2474.855),(-117.97253,2745.3142)),((-89.68823,2794.304),(-128.32533,2783.9514)),((-117.97253,2745.3142),(-79.335526,2755.667)),((-178.49438,3590.2566),(-241.50847,3573.372)),((-241.50847,3573.372),(-210.16953,3456.4133)),((-194.64026,3419.1633),(-136.80266,3434.6611)),((-98.165634,3445.014),(-139.85736,3600.6094)),((-92.98925,3425.6953),(-98.165634,3445.014)),((-136.80266,3434.6611),(-127.74397,3400.8535)),((-187.553,3624.064),(-178.49438,3590.2566)),((-139.85736,3600.6094),(-148.91603,3634.4167)),((-127.74397,3400.8535),(-111.20285,3339.121)),((-78.55679,3371.8325),(-92.98925,3425.6953)),((-349.5008,4383.0093),(-388.13782,4372.6563)),((-388.13782,4372.6563),(-485.18823,3653.0168)),((-485.18823,3653.0168),(-477.42368,3624.039)),((-477.42368,3624.039),(-206.96445,3696.5085)),((-168.32744,3706.861),(102.131805,3779.3306)),((102.131805,3779.3306),(94.36725,3808.308)),((94.36725,3808.308),(-349.5008,4383.0093)),((-206.96445,3696.5085),(-187.553,3624.064)),((-148.91603,3634.4167),(-168.32744,3706.861)),((299.35522,3346.2668),(97.2383,3547.9797)),((97.2383,3547.9797),(-78.55679,3371.8325)),((-111.20285,3339.121),(116.74672,3110.6904)),((116.74672,3110.6904),(320.08704,3314.438)),((352.084,3395.578),(299.35522,3346.2668)),((320.08704,3314.438),(367.6133,3358.328)),((495.06226,3666.979),(293.8115,3613.054)),((293.8115,3613.054),(352.084,3395.578)),((367.6133,3358.328),(563.6875,3410.866)),((563.6875,3410.866),(495.06226,3666.979))]
|
||||||
|
|
||||||
intersectingBrokenWalls :: [(Point2,Point2)]
|
intersectingBrokenWalls :: [(Point2,Point2)]
|
||||||
intersectingBrokenWalls = filter (\(a,b) -> test a b) brokenWalls
|
intersectingBrokenWalls = filter (uncurry test) brokenWalls
|
||||||
where
|
where
|
||||||
polyPairs = zip brokenPoly (tail brokenPoly ++ [head brokenPoly])
|
polyPairs = zip brokenPoly (tail brokenPoly ++ [head brokenPoly])
|
||||||
test a b = any (isJust . uncurry (myIntersectSegSeg a b)) polyPairs
|
test a b = any (isJust . uncurry (myIntersectSegSeg a b)) polyPairs
|
||||||
@@ -300,7 +300,7 @@ findShadowWalls :: WallP -> [WallP] -> [WallP]
|
|||||||
findShadowWalls (p1,p2) wls = hitWls
|
findShadowWalls (p1,p2) wls = hitWls
|
||||||
where
|
where
|
||||||
p3 = 0.5 *.* (p1 +.+ p2)
|
p3 = 0.5 *.* (p1 +.+ p2)
|
||||||
p4 = p3 +.+ 10000 *.* rotateV (0) (vNormal (p2 -.- p1))
|
p4 = p3 +.+ 10000 *.* vNormal (p2 -.- p1)
|
||||||
hitWls = sortOn (dist p3 . fromJust . f) $ filter (isJust . f) wls
|
hitWls = sortOn (dist p3 . fromJust . f) $ filter (isJust . f) wls
|
||||||
f = uncurry $ myIntersectSegSeg p3 p4
|
f = uncurry $ myIntersectSegSeg p3 p4
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ bulBounceArmCr' bt p cr w
|
|||||||
pOut = p +.+ 2 *.* newDir
|
pOut = p +.+ 2 *.* newDir
|
||||||
reflectVel = magV bulVel *.* newDir
|
reflectVel = magV bulVel *.* newDir
|
||||||
addBouncer = worldEvents %~ ( over particles (bouncer :) . )
|
addBouncer = worldEvents %~ ( over particles (bouncer :) . )
|
||||||
bouncer = (aGenBulAt Nothing (_btColor' bt) pOut reflectVel
|
bouncer = (aGenBulAt Nothing pOut reflectVel
|
||||||
(_btHitEffect' bt) (_btWidth' bt)
|
(_btHitEffect' bt) (_btWidth' bt)
|
||||||
) {_btTimer' = _btTimer' bt - 1}
|
) {_btTimer' = _btTimer' bt - 1}
|
||||||
{- | Bullet pass through creatures. -}
|
{- | Bullet pass through creatures. -}
|
||||||
@@ -83,7 +83,7 @@ bulPenCr' bt p cr w
|
|||||||
sp = head $ _btTrail' bt
|
sp = head $ _btTrail' bt
|
||||||
ep = sp +.+ _btVel' bt
|
ep = sp +.+ _btVel' bt
|
||||||
addPiercer = over particles (piercer :)
|
addPiercer = over particles (piercer :)
|
||||||
piercer = (aGenBulAt (Just cid) (_btColor' bt) p (_btVel' bt)
|
piercer = (aGenBulAt (Just cid) p (_btVel' bt)
|
||||||
(_btHitEffect' bt) (_btWidth' bt)
|
(_btHitEffect' bt) (_btWidth' bt)
|
||||||
) {_btTimer' = _btTimer' bt - 1}
|
) {_btTimer' = _btTimer' bt - 1}
|
||||||
{- | Heavy bullet effects when hitting creature:
|
{- | Heavy bullet effects when hitting creature:
|
||||||
@@ -149,7 +149,7 @@ bulBounceWall' bt p wl w = damageBlocksBy 5 wl $ over worldEvents addBouncer w
|
|||||||
where
|
where
|
||||||
sp = head $ _btTrail' bt
|
sp = head $ _btTrail' bt
|
||||||
pOut = p +.+ safeNormalizeV (sp -.- p)
|
pOut = p +.+ safeNormalizeV (sp -.- p)
|
||||||
bouncer = (aGenBulAt Nothing (_btColor' bt) pOut reflectVel
|
bouncer = (aGenBulAt Nothing pOut reflectVel
|
||||||
(_btHitEffect' bt) (_btWidth' bt)
|
(_btHitEffect' bt) (_btWidth' bt)
|
||||||
) {_btTimer' = _btTimer' bt - 1}
|
) {_btTimer' = _btTimer' bt - 1}
|
||||||
wallV = uncurry (-.-) (_wlLine wl)
|
wallV = uncurry (-.-) (_wlLine wl)
|
||||||
|
|||||||
@@ -10,15 +10,14 @@ import Control.Lens
|
|||||||
|
|
||||||
aGenBulAt
|
aGenBulAt
|
||||||
:: Maybe Int -- ^ Pass-through creature id
|
:: Maybe Int -- ^ Pass-through creature id
|
||||||
-> Color
|
|
||||||
-> Point2 -- ^ Start position
|
-> Point2 -- ^ Start position
|
||||||
-> Point2 -- ^ Velocity
|
-> Point2 -- ^ Velocity
|
||||||
-> HitEffect
|
-> HitEffect
|
||||||
-> Float -- ^ Bullet width
|
-> Float -- ^ Bullet width
|
||||||
-> Particle
|
-> Particle
|
||||||
aGenBulAt maycid _ pos vel hiteff width = Bul'
|
aGenBulAt maycid pos vel hiteff width = Bul'
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate' = mvGenBullet'
|
, _ptUpdate' = mvGenBullet
|
||||||
, _btVel' = vel
|
, _btVel' = vel
|
||||||
, _btColor' = white
|
, _btColor' = white
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
@@ -39,7 +38,7 @@ aCurveBulAt
|
|||||||
-> Particle
|
-> Particle
|
||||||
aCurveBulAt maycid col pos control targ hiteff width = Bul'
|
aCurveBulAt maycid col pos control targ hiteff width = Bul'
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate' = \w -> mvGenBullet' w . setVel
|
, _ptUpdate' = \w -> mvGenBullet w . setVel
|
||||||
, _btVel' = (0,0)
|
, _btVel' = (0,0)
|
||||||
, _btColor' = col
|
, _btColor' = col
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import Control.Lens
|
|||||||
{-
|
{-
|
||||||
Update for a generic bullet.
|
Update for a generic bullet.
|
||||||
-}
|
-}
|
||||||
mvGenBullet' :: World -> Particle -> (World, Maybe Particle)
|
mvGenBullet :: World -> Particle -> (World, Maybe Particle)
|
||||||
mvGenBullet' w bt
|
mvGenBullet w bt
|
||||||
| t <= 0 = (w, Nothing)
|
| t <= 0 = (w, Nothing)
|
||||||
| t < 4 = (w, Just $ set btPassThrough' Nothing
|
| t < 4 = (w, Just $ set btPassThrough' Nothing
|
||||||
$ set btTrail' (p:p:ps)
|
$ set btTrail' (p:p:ps)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ worldPictures w = pictures $ concat
|
|||||||
, map _pjPict . IM.elems $ _projectiles w
|
, map _pjPict . IM.elems $ _projectiles w
|
||||||
, map drawItem . IM.elems $ _floorItems w
|
, map drawItem . IM.elems $ _floorItems w
|
||||||
, map crDraw . IM.elems $ _creatures w
|
, map crDraw . IM.elems $ _creatures w
|
||||||
, map clDraw . IM.elems $ _clouds w
|
, map clDraw . reverse . IM.elems $ _clouds w
|
||||||
, map ppDraw . IM.elems $ _pressPlates w
|
, map ppDraw . IM.elems $ _pressPlates w
|
||||||
, map btDraw (IM.elems (_buttons w))
|
, map btDraw (IM.elems (_buttons w))
|
||||||
, map (\pt -> _ptDraw pt pt) $ _particles w
|
, map (\pt -> _ptDraw pt pt) $ _particles w
|
||||||
@@ -47,7 +47,8 @@ customMouseCursor w =
|
|||||||
testPic :: World -> [Picture]
|
testPic :: World -> [Picture]
|
||||||
testPic w =
|
testPic w =
|
||||||
[ setDepth (-1) . translate 0 0.8
|
[ setDepth (-1) . translate 0 0.8
|
||||||
. scale 0.001 0.001 . text . show . length . IM.elems . IM.filter ( (== 3) . _crRad ) $ _creatures w
|
. scale 0.001 0.001 . text . show . length . IM.elems
|
||||||
|
. IM.filter ( (== 3) . _crRad ) $ _creatures w
|
||||||
]
|
]
|
||||||
|
|
||||||
crDraw :: Creature -> Picture
|
crDraw :: Creature -> Picture
|
||||||
@@ -60,7 +61,6 @@ btDraw c = uncurry translate (_btPos c) $ rotate (_btRot c) (_btPict c)
|
|||||||
clDraw :: Cloud -> Picture
|
clDraw :: Cloud -> Picture
|
||||||
clDraw c = uncurry translate (_clPos c) (_clPict c c)
|
clDraw c = uncurry translate (_clPos c) (_clPict c c)
|
||||||
|
|
||||||
|
|
||||||
wallFloorsToDraw :: World -> [Wall]
|
wallFloorsToDraw :: World -> [Wall]
|
||||||
wallFloorsToDraw w = filter isVisible $ IM.elems $ wallsOnScreen w
|
wallFloorsToDraw w = filter isVisible $ IM.elems $ wallsOnScreen w
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ createBarrelSpark pos dir maycid time colid w
|
|||||||
where
|
where
|
||||||
spark = Bul'
|
spark = Bul'
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate' = mvGenBullet'
|
, _ptUpdate' = mvGenBullet
|
||||||
, _btVel' = rotateV dir (5,0)
|
, _btVel' = rotateV dir (5,0)
|
||||||
, _btColor' = numColor colid
|
, _btColor' = numColor colid
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ import qualified IntMapHelp as IM
|
|||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
makeCloudAt :: Float -> Int -> (Cloud -> Picture) -> Point2 -> World -> World
|
makeCloudAt :: Float -> Int -> (Cloud -> Picture) -> Point2 -> World -> World
|
||||||
makeCloudAt rad t drawFunc p w
|
makeCloudAt rad t drawFunc p w = w & clouds %~ IM.insert i theCloud
|
||||||
= w & clouds %~ IM.insert i theCloud
|
where
|
||||||
where i = IM.newKey $ _clouds w
|
i = IM.newKey $ _clouds w
|
||||||
theCloud = Cloud { _clID = i
|
theCloud = Cloud
|
||||||
|
{ _clID = i
|
||||||
, _clPos = p
|
, _clPos = p
|
||||||
, _clVel = (0,0)
|
, _clVel = (0,0)
|
||||||
, _clPict = drawFunc
|
, _clPict = drawFunc
|
||||||
@@ -27,9 +28,8 @@ drawCloudWith radMult fadet col cl
|
|||||||
= setLayer 2
|
= setLayer 2
|
||||||
. setDepth (-0.5)
|
. setDepth (-0.5)
|
||||||
$ circleSolidCol (withAlpha 0 col) (withAlpha a col) (radMult * _clRad cl)
|
$ circleSolidCol (withAlpha 0 col) (withAlpha a col) (radMult * _clRad cl)
|
||||||
-- . color (withAlpha a col)
|
where
|
||||||
-- $ circleSolid (radMult * _clRad cl)
|
a = min 1 $ fromIntegral (_clTimer cl) / fadet
|
||||||
where a = min 1 $ fromIntegral (_clTimer cl) / fadet
|
|
||||||
|
|
||||||
makeThickSmokeAt :: Point2 -> World -> World
|
makeThickSmokeAt :: Point2 -> World -> World
|
||||||
makeThickSmokeAt = makeCloudAt 3 50 (drawCloudWith 4 50 black)
|
makeThickSmokeAt = makeCloudAt 3 50 (drawCloudWith 4 50 black)
|
||||||
@@ -41,8 +41,8 @@ makeSmokeCloudAt :: Point2 -> World -> World
|
|||||||
--makeSmokeCloudAt = makeCloudAt 10 200 (drawCloudWith 2 200 (greyN 0.5))
|
--makeSmokeCloudAt = makeCloudAt 10 200 (drawCloudWith 2 200 (greyN 0.5))
|
||||||
makeSmokeCloudAt = makeCloudAt 15 400 (drawCloudWith (4/3) 800 (greyN 0.5))
|
makeSmokeCloudAt = makeCloudAt 15 400 (drawCloudWith (4/3) 800 (greyN 0.5))
|
||||||
|
|
||||||
makeFlamerSmokeAt :: Point2 -> World -> World
|
makeFlamerSmokeAt :: Float -> Point2 -> World -> World
|
||||||
makeFlamerSmokeAt = makeCloudAt 3 200 (drawCloudWith 4 200 (greyN 0.5))
|
makeFlamerSmokeAt x = makeCloudAt 6 200 (drawCloudWith 4 300 (greyN x))
|
||||||
|
|
||||||
spawnSmokeAtCursor :: World -> World
|
spawnSmokeAtCursor :: World -> World
|
||||||
spawnSmokeAtCursor w = makeSmokeCloudAt (mouseWorldPos w) w
|
spawnSmokeAtCursor w = makeSmokeCloudAt (mouseWorldPos w) w
|
||||||
|
|||||||
@@ -47,15 +47,6 @@ aFlameParticle t pos vel maycid = Pt'
|
|||||||
, _btHitEffect' = destroyOnImpact (doFlameDam 1) noEff noEff
|
, _btHitEffect' = destroyOnImpact (doFlameDam 1) noEff noEff
|
||||||
}
|
}
|
||||||
|
|
||||||
makeFlame
|
|
||||||
:: Int -- ^ Timer
|
|
||||||
-> Point2 -- ^ Position
|
|
||||||
-> Point2 -- ^ Velocity
|
|
||||||
-> Maybe Int -- ^ Creature id
|
|
||||||
-> World
|
|
||||||
-> World
|
|
||||||
makeFlame t pos vel maycid = over particles (aFlameParticle t pos vel maycid : )
|
|
||||||
|
|
||||||
drawFlame
|
drawFlame
|
||||||
:: Point2 -- ^ Rotate direction
|
:: Point2 -- ^ Rotate direction
|
||||||
-> Particle -> Picture
|
-> Particle -> Picture
|
||||||
@@ -87,9 +78,7 @@ drawFlame rotd pt = thePic
|
|||||||
prot2 p' = p' +.+ rotateV (negate $ fromIntegral time) (0,1)
|
prot2 p' = p' +.+ rotateV (negate $ fromIntegral time) (0,1)
|
||||||
prot3 p' = p' +.+ rotateV (2 + fromIntegral time * 0.1) (0,2)
|
prot3 p' = p' +.+ rotateV (2 + fromIntegral time * 0.1) (0,2)
|
||||||
|
|
||||||
{-
|
{- TODO: add generalised area damage particles/hiteffects. -}
|
||||||
TODO: add generalised area damage particles/hiteffects.
|
|
||||||
-}
|
|
||||||
moveFlame
|
moveFlame
|
||||||
:: Point2 -- ^ Rotation direction
|
:: Point2 -- ^ Rotation direction
|
||||||
-> World
|
-> World
|
||||||
@@ -103,8 +92,7 @@ moveFlame rotd w pt
|
|||||||
_ -> (soundAndGlare damcrs , mvPt)
|
_ -> (soundAndGlare damcrs , mvPt)
|
||||||
where
|
where
|
||||||
time = _btTimer' pt
|
time = _btTimer' pt
|
||||||
soundAndGlare = soundFrom Flame fireSound 2 500
|
soundAndGlare = soundFrom Flame fireSound 2 500 . over worldEvents ((.) $ flameGlareAt ep)
|
||||||
. over worldEvents ((.) $ flameGlareAt ep)
|
|
||||||
sp = _btPos' pt
|
sp = _btPos' pt
|
||||||
vel = _btVel' pt
|
vel = _btVel' pt
|
||||||
ep = sp +.+ vel
|
ep = sp +.+ vel
|
||||||
@@ -130,8 +118,8 @@ moveFlame rotd w pt
|
|||||||
pOut p = p +.+ safeNormalizeV (sp -.- p)
|
pOut p = p +.+ safeNormalizeV (sp -.- p)
|
||||||
reflV wall = (0.3 *.* reflectIn (uncurry (-.-) . swap $ _wlLine wall) vel )
|
reflV wall = (0.3 *.* reflectIn (uncurry (-.-) . swap $ _wlLine wall) vel )
|
||||||
+.+ (0.2 *.* vel)
|
+.+ (0.2 *.* vel)
|
||||||
smokeGen = makeFlamerSmokeAt ep
|
smokeCol = fst $ randomR (0.2,0.5) (_randGen w)
|
||||||
|
smokeGen = makeFlamerSmokeAt smokeCol ep
|
||||||
makeFlameletTimed
|
makeFlameletTimed
|
||||||
:: Point2 -- ^ Position
|
:: Point2 -- ^ Position
|
||||||
-> Point2 -- ^ Velocity
|
-> Point2 -- ^ Velocity
|
||||||
@@ -404,7 +392,7 @@ createSpark time colid pos dir maycid w
|
|||||||
where
|
where
|
||||||
spark = Bul'
|
spark = Bul'
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate' = mvGenBullet'
|
, _ptUpdate' = mvGenBullet
|
||||||
, _btVel' = rotateV dir (5,0)
|
, _btVel' = rotateV dir (5,0)
|
||||||
, _btColor' = numColor colid
|
, _btColor' = numColor colid
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
@@ -425,7 +413,7 @@ createSparkCol time col pos dir maycid w
|
|||||||
where
|
where
|
||||||
spark = Bul'
|
spark = Bul'
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate' = mvGenBullet'
|
, _ptUpdate' = mvGenBullet
|
||||||
, _btVel' = rotateV dir (5,0)
|
, _btVel' = rotateV dir (5,0)
|
||||||
, _btColor' = col
|
, _btColor' = col
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
|
|||||||
Reference in New Issue
Block a user