Add support for left click actions
This commit is contained in:
@@ -10,6 +10,7 @@ import Dodge.Creature.Action
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.WorldEvent
|
||||
import Dodge.Default
|
||||
import Dodge.Default.Shell
|
||||
import Dodge.Item.Draw
|
||||
import Dodge.Particle.Bullet.HitEffect
|
||||
import Dodge.Particle.Bullet.Spawn
|
||||
@@ -59,6 +60,7 @@ pistol = Weapon
|
||||
. withMuzFlare
|
||||
. withVelWthHiteff (30,0) 2
|
||||
$ destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
, _itLeftClickUse = Nothing
|
||||
, _wpSpread = 0.02
|
||||
, _wpRange = 20
|
||||
, _itHammer = HammerUp
|
||||
@@ -317,7 +319,7 @@ bezierGun = defaultAutoGun
|
||||
, _itScrollUp = removeItAttachment 0
|
||||
, _itScrollDown = removeItAttachment 0
|
||||
, _itHammer = HammerUp
|
||||
, _itEffect = bezierTargetEffect
|
||||
, _itEffect = rbSetTarget
|
||||
, _itZoom = defaultItZoom
|
||||
, _itAimingRange = 0
|
||||
}
|
||||
@@ -572,6 +574,7 @@ blinkGun = defaultGun
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itUse = hammerCheck $ shoot aSelf
|
||||
, _itLeftClickUse = Just $ hammerCheckL $ shootL aSelfL
|
||||
, _wpSpread = 0.05
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||
@@ -589,6 +592,7 @@ boosterGun = defaultGun
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itUse = boostSelf 10
|
||||
, _itLeftClickUse = Just $ boostSelfL 10
|
||||
, _wpSpread = 0.05
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||
@@ -635,7 +639,7 @@ makeShellAt
|
||||
-> Point2 -- ^ Start position
|
||||
-> Float -- ^ Direction
|
||||
-> Projectile
|
||||
makeShellAt pl i cid pos dir = Shell
|
||||
makeShellAt pl i cid pos dir = defaultShell
|
||||
{ _pjPos = pos
|
||||
, _pjStartPos = pos
|
||||
, _pjVel = rotateV dir (1,0)
|
||||
@@ -747,6 +751,9 @@ aFlame cr w = w & particles %~ (aFlameParticle t pos vel (Just cid) :)
|
||||
aSelf :: Creature -> World -> World
|
||||
aSelf = blinkAction
|
||||
|
||||
aSelfL :: Creature -> Int -> World -> World
|
||||
aSelfL cr _ = blinkAction cr
|
||||
|
||||
reflect :: Float -> Float -> Float
|
||||
reflect a b = a + 2*(a-b)
|
||||
|
||||
@@ -772,11 +779,13 @@ retireRemoteRocket itid t pjid w = setScope w
|
||||
pos = fromMaybe (0,0) $ w ^? projectiles . ix pjid . pjPos
|
||||
|
||||
retireRemoteBomb :: Int -> Int -> Int -> World -> World
|
||||
retireRemoteBomb itid 0 pjid w =
|
||||
set (pointToItem (_itemPositions w IM.! itid) . itAttachment . _Just . scopePos) (0,0)
|
||||
$ set (pointToItem (_itemPositions w IM.! itid) . itZoom) defaultItZoom
|
||||
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (hammerCheck throwRemoteBomb)
|
||||
(w & projectiles %~ IM.delete pjid)
|
||||
retireRemoteBomb itid 0 pjid w = w
|
||||
& pointToItem (_itemPositions w IM.! itid) %~
|
||||
( (itAttachment . _Just . scopePos .~ (0,0))
|
||||
. (itZoom .~ defaultItZoom)
|
||||
. (itUse .~ hammerCheck throwRemoteBomb)
|
||||
)
|
||||
& projectiles %~ IM.delete pjid
|
||||
retireRemoteBomb itid t pjid w = setScope w
|
||||
& projectiles . ix pjid . pjUpdate .~ (\_ -> retireRemoteBomb itid (t-1) pjid)
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user