Add sound effects to example analyser
This commit is contained in:
@@ -15,6 +15,7 @@ import Dodge.Default
|
||||
--import Dodge.Room.RoadBlock
|
||||
import Dodge.Placement.Instance
|
||||
import Dodge.Placement.Shift
|
||||
import Dodge.SoundLogic
|
||||
--import Dodge.Default.Room
|
||||
--import Dodge.Item.Weapon.BulletGuns
|
||||
--import Dodge.Item.Weapon.Utility
|
||||
@@ -66,11 +67,11 @@ analyser' starts sucs fails afters upf pslight psmc = extTrigLitPos pslight $ \t
|
||||
, _termTitle = "ANALYSER"
|
||||
}
|
||||
)
|
||||
(\mc -> upf mc . (triggers . ix (fromJust $ _plMID tp) .~ const (_mcSensorToggle mc))
|
||||
(\mc -> upf mc . (triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc))
|
||||
)
|
||||
simpleline str = TerminalLineDisplay {_tlPause = 0, _tlString = const (str,white)}
|
||||
testline' mcid = TerminalLineDisplay 0 (testline mcid)
|
||||
testline mcid w = case w ^? machines . ix mcid . mcSensorToggle of
|
||||
testline mcid w = case w ^? machines . ix mcid . mcSensor . sensToggle of
|
||||
Just True -> (sucs,green)
|
||||
_ -> (fails,red)
|
||||
updatebuttonname = plType . putButton . btText .~ "ANALYSER"
|
||||
@@ -88,8 +89,9 @@ analyser starts sucs fails afters upf pslight psmc = extTrigLitPos pslight $ \tp
|
||||
Just $ psPtCont psmc
|
||||
(PutMachine aquamarine (reverse $ square 10) defaultMachine
|
||||
{ _mcDraw = const . noPic . colorSH aquamarine . upperPrismPoly 25 $ square 10
|
||||
, _mcUpdate = \mc -> (triggers . ix (fromJust $ _plMID tp) .~ const (_mcSensorToggle mc))
|
||||
, _mcUpdate = \mc -> (triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc))
|
||||
. upf mc
|
||||
, _mcSensor = SensorCloseToggle NotClose False
|
||||
}
|
||||
) $ \anmc -> Just
|
||||
$ plSpot .~ shiftRelativeToPS (V2 20 0) (_plSpot anmc)
|
||||
@@ -104,15 +106,26 @@ analyser starts sucs fails afters upf pslight psmc = extTrigLitPos pslight $ \tp
|
||||
where
|
||||
simpleline str = TerminalLineDisplay {_tlPause = 0, _tlString = const (str,white)}
|
||||
testline' mcid = TerminalLineDisplay 0 (testline mcid)
|
||||
testline mcid w = case w ^? machines . ix mcid . mcSensorToggle of
|
||||
testline mcid w = case w ^? machines . ix mcid . mcSensor . sensToggle of
|
||||
Just True -> (sucs,green)
|
||||
_ -> (fails,red)
|
||||
updatebuttontext = plType . putButton . btText .~ "ANALYSER"
|
||||
|
||||
testYourHealth :: Int -> Machine -> World -> World
|
||||
testYourHealth hp mc w
|
||||
| _crHP ycr >= hp && dist (_crPos ycr) (_mcPos mc) < 40
|
||||
= w & machines . ix (_mcID mc) . mcSensorToggle .~ True
|
||||
| otherwise = w
|
||||
testYourHealth hp mc w = case (_sensCloseToggle sens
|
||||
, _sensToggle sens
|
||||
, _crHP ycr >= hp
|
||||
, dist (_crPos ycr) (_mcPos mc) < 40) of
|
||||
(_,True,_,_) -> w
|
||||
(_,False,True,True) -> w
|
||||
& machines . ix (_mcID mc) . mcSensor . sensToggle .~ True
|
||||
& playsound dededaS
|
||||
& machines . ix (_mcID mc) . mcSensor . sensCloseToggle .~ IsClose
|
||||
(NotClose,_,False,True) -> w & playsound dededumS
|
||||
& machines . ix (_mcID mc) . mcSensor . sensCloseToggle .~ IsClose
|
||||
(_,_,_,False) -> w & machines . ix (_mcID mc) . mcSensor . sensCloseToggle .~ NotClose
|
||||
_ -> w
|
||||
where
|
||||
playsound sid = soundContinue (MachineAltSound (_mcID mc)) (_mcPos mc) sid Nothing
|
||||
ycr = you w
|
||||
sens = _mcSensor mc
|
||||
|
||||
Reference in New Issue
Block a user