Add twisting weapons and feet
This commit is contained in:
@@ -45,3 +45,5 @@ data AimStance
|
||||
| TwoHand
|
||||
| OneHand
|
||||
| LeaveHolstered
|
||||
deriving
|
||||
(Eq,Show,Ord,Enum)
|
||||
|
||||
+13
-4
@@ -1,25 +1,34 @@
|
||||
module Dodge.Item.Draw
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Item.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Creature.Stance.Data
|
||||
import Picture
|
||||
{- |
|
||||
Places an item picture onto a creature when the item is selected. -}
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
{- | Places an item picture onto a creature when the item is selected. -}
|
||||
pictureWeaponOnAim
|
||||
:: Picture
|
||||
-> Creature
|
||||
-> Int -- ^ Position of item in inventory
|
||||
-> Picture
|
||||
pictureWeaponOnAim p cr posInInv
|
||||
| _crInvSel cr == posInInv && _posture (_crStance cr) == Aiming
|
||||
| isSelected && _posture (_crStance cr) == Aiming
|
||||
&& isTwisting
|
||||
= onLayer PtLayer twistWep
|
||||
| isSelected && _posture (_crStance cr) == Aiming
|
||||
= onLayer PtLayer drawnWep
|
||||
| _crInvSel cr == posInInv
|
||||
| isSelected
|
||||
= onLayer PtLayer holsteredWep
|
||||
| otherwise = blank
|
||||
where
|
||||
isSelected = _crInvSel cr == posInInv
|
||||
drawnWep = uncurry translate (_crRad cr,0) p
|
||||
twistWep = uncurry translate (0.5 * _crRad cr,negate 0.5 * _crRad cr) p
|
||||
holsteredWep = uncurry translate (_crRad cr,0) (scale 0.1 1 p)
|
||||
theIt = _crInv cr IM.! posInInv
|
||||
isTwisting = _itAimStance theIt == TwoHandTwist
|
||||
|
||||
pictureItem
|
||||
:: Picture
|
||||
|
||||
+10
-49
@@ -20,6 +20,7 @@ import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Item.Weapon.UseEffect
|
||||
import Dodge.Item.Weapon.Laser
|
||||
import Dodge.Item.Weapon.Shell
|
||||
import Dodge.Item.Weapon.Bullet
|
||||
import Dodge.Default.Weapon
|
||||
import Dodge.Item.Weapon.Booster
|
||||
import Dodge.Item.Weapon.Grenade
|
||||
@@ -83,13 +84,6 @@ pistol = defaultGun
|
||||
, _itWorldTrigger = Nothing
|
||||
, _wpAmmo = basicBullet
|
||||
}
|
||||
basicBullet :: Ammo
|
||||
basicBullet = BulletAmmo
|
||||
{ _amString = "BULLET"
|
||||
, _amBulEff = destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
, _amBulWth = 2
|
||||
, _amBulVel = (30,0)
|
||||
}
|
||||
useAmmoParams :: Item -> Creature -> World -> World
|
||||
useAmmoParams it = withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b)
|
||||
where
|
||||
@@ -105,45 +99,6 @@ autoEffectGun name eff = defaultAutoGun
|
||||
{ _itName = name ++ "Gun"
|
||||
, _itUse = \_ -> eff
|
||||
}
|
||||
autoGun :: Item
|
||||
autoGun = defaultGun
|
||||
{ _itName = "AUTOGUN"
|
||||
, _itIdentity = AutoGun
|
||||
, _wpMaxAmmo = 30
|
||||
, _wpLoadedAmmo = 30
|
||||
, _wpReloadTime = 80
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 6
|
||||
, _itUseTime = 0
|
||||
, _itUse = \_ -> charFiringStrat
|
||||
[('M',autoFireMode)
|
||||
,('S',singleFireMode)
|
||||
]
|
||||
, _wpSpread = autogunSpread
|
||||
, _wpRange = 20
|
||||
, _itHammer = HammerUp
|
||||
, _itFloorPict = onLayer FlItLayer $ color red $ pictures [polygon [(-4,-4),(-4,4),(4,4),(4,-4)]]
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||
, _itEquipPict = pictureWeaponOnAim $ color red $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||
, _itEffect = wpRecock
|
||||
, _itAttachment = Just $ ItCharMode $ Seq.fromList "MS"
|
||||
, _itScrollUp = incCharMode
|
||||
, _itScrollDown = decCharMode
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _wpAmmo = basicBullet
|
||||
}
|
||||
autoFireMode, singleFireMode, autoGunNonTwistEff :: Creature -> World -> World
|
||||
autoFireMode = shootWithSound (fromIntegral autoGunSound)
|
||||
. torqueBefore 0.05
|
||||
$ autoGunNonTwistEff
|
||||
singleFireMode = hammerCheck $ shootWithSound (fromIntegral autoGunSound) autoGunNonTwistEff
|
||||
autoGunNonTwistEff = withRecoil 40
|
||||
. withRandomDir (autogunSpread/2)
|
||||
. withMuzFlare
|
||||
. withVelWthHiteff (50,0) 3
|
||||
$ destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
rezGun :: Item
|
||||
rezGun = defaultGun
|
||||
{ _itName = "REANIMATOR"
|
||||
@@ -364,11 +319,17 @@ miniGun = defaultAutoGun
|
||||
. withVelWthHiteff (30,0) 2
|
||||
$ destroyOnImpact bulBounceArmCr' bulHitWall' bulHitFF'
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
||||
, _itFloorPict = onLayer FlItLayer miniGunPict
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itEquipPict = pictureWeaponOnAim $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
||||
, _itEquipPict = pictureWeaponOnAim miniGunPict
|
||||
}
|
||||
miniGunPict :: Picture
|
||||
miniGunPict = pictures
|
||||
[ translate 5 0 . color red $ polygon $ rectNESW 9 7 (-9) (-5)
|
||||
, color red . polygon $ rectNESW 4 12 (-4) (-12)
|
||||
]
|
||||
|
||||
spreadGun :: Item
|
||||
spreadGun = defaultGun
|
||||
{ _itName = "SPREAD"
|
||||
@@ -1023,7 +984,7 @@ spawnGun cr = defaultGun
|
||||
, _wpReloadTime = 80
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 100
|
||||
, _itUse = \_ -> spawnCrNextTo cr
|
||||
, _itUse = \_ -> hammerCheck $ spawnCrNextTo cr
|
||||
}
|
||||
spawnCrNextTo
|
||||
:: Creature -- ^ Creature to spawn
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
module Dodge.Item.Weapon.AutoGun
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Default.Weapon
|
||||
import Dodge.Default
|
||||
import Dodge.Item.Attachment
|
||||
import Dodge.Item.Attachment.Data
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Item.Weapon.InventoryDisplay
|
||||
import Dodge.Item.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Item.Draw
|
||||
import Dodge.Item.Weapon.Bullet
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.WorldEvent.HitEffect
|
||||
import Dodge.Particle.Bullet.HitEffect
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
import qualified Data.Sequence as Seq
|
||||
|
||||
autoGun :: Item
|
||||
autoGun = defaultAutoGun
|
||||
{ _itName = "AUTOGUN"
|
||||
, _itIdentity = AutoGun
|
||||
, _wpMaxAmmo = 30
|
||||
, _wpLoadedAmmo = 30
|
||||
, _wpReloadTime = 80
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 6
|
||||
, _itUseTime = 0
|
||||
, _itUse = \_ -> charFiringStrat
|
||||
[('M',autoFireMode)
|
||||
,('S',singleFireMode)
|
||||
]
|
||||
, _wpSpread = autogunSpread
|
||||
, _wpRange = 20
|
||||
, _itHammer = HammerUp
|
||||
, _itFloorPict = onLayer FlItLayer autoGunPict
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||
, _itEquipPict = pictureWeaponOnAim autoGunPict
|
||||
, _itEffect = wpRecock
|
||||
, _itAttachment = Just $ ItCharMode $ Seq.fromList "MS"
|
||||
, _itScrollUp = incCharMode
|
||||
, _itScrollDown = decCharMode
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _wpAmmo = basicBullet
|
||||
}
|
||||
autoFireMode, singleFireMode, autoGunNonTwistEff :: Creature -> World -> World
|
||||
autoFireMode = shootWithSound (fromIntegral autoGunSound)
|
||||
. torqueBefore 0.05
|
||||
$ autoGunNonTwistEff
|
||||
singleFireMode = hammerCheck $ shootWithSound (fromIntegral autoGunSound) autoGunNonTwistEff
|
||||
autoGunNonTwistEff = withRecoil 40
|
||||
. withRandomDir (autogunSpread/2)
|
||||
. withMuzFlare
|
||||
. withVelWthHiteff (50,0) 3
|
||||
$ destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
|
||||
autoGunPict :: Picture
|
||||
autoGunPict = color red $ polygon $ rectNESW 4 12 (-4) (-12)
|
||||
|
||||
autogunSpread :: Float
|
||||
autogunSpread = 0.07
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
module Dodge.Item.Weapon.Bullet
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.WorldEvent.HitEffect
|
||||
import Dodge.Particle.Bullet.HitEffect
|
||||
basicBullet :: Ammo
|
||||
basicBullet = BulletAmmo
|
||||
{ _amString = "BULLET"
|
||||
, _amBulEff = destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
, _amBulWth = 2
|
||||
, _amBulVel = (30,0)
|
||||
}
|
||||
Reference in New Issue
Block a user