edge 0.8.8 → 0.8.10
raw patch · 8 files changed
+24/−27 lines, 8 files
Files
- Display.hs +5/−10
- Resources.hs +3/−3
- Step.hs +5/−9
- Universe.hs +2/−4
- edge.cabal +1/−1
- edge.hs +8/−0
- sound/music.wav too large to diff
- sound/simple-energy-shot.wav binary
Display.hs view
@@ -17,6 +17,7 @@ import Item import ResourceTracker import Trigonometry+import Resources data Displayable = forall a. (Locatable a, Animation a) => Displayable a @@ -29,12 +30,10 @@ let pship = do lance' <- lance arena' Just (image lance' undefined) in let pship' = fromMaybe Blank pship in- let viewCenterWp = case lance arena' of- Just x -> Moving.center x- Nothing -> lastFocus arena' in+ let viewCenterWp = focus arena' in let displayables = do (Displayable displayable)- <- map Displayable (stars arena')+ <- map Displayable stars ++ map Displayable (asteroids arena') ++ [ Displayable a | Projectile a <- lanceProjectiles arena'@@ -242,9 +241,7 @@ , (2.0, 0.0) ]) in let unitDots =- [ let cp = case lance arena of- Nothing -> lastFocus arena- Just l -> Moving.center l in+ [ let cp = focus arena in let (x, y) = vectorRelation wmap cp c in Translate (double2Float (-x))@@ -258,9 +255,7 @@ ++ map Moving.center (smartUnits arena) ] in let itemDots =- [ let cp = case lance arena of- Nothing -> lastFocus arena- Just l -> Moving.center l in+ [ let cp = focus arena in let (x, y) = vectorRelation wmap cp c in Translate (double2Float (-x))
Resources.hs view
@@ -71,6 +71,7 @@ , "blip.wav" , "energy-shot-02.wav" , "explosion.wav"+ , "music.wav" , "simple-energy-shot.wav" ] in let soundFiles' = map ("sound/" ++) soundFiles in@@ -99,7 +100,7 @@ ] in map (\(p, v) -> Asteroid.new rt wmap (wrappoint wmap p) v) positionsVelocities -defaultStars =+stars = [ Star { Star.location = wrappoint wmap (40.0, 93.0), Star.color = rose } , Star { Star.location = wrappoint wmap (54.0, 74.0), Star.color = white } , Star { Star.location = wrappoint wmap (86.0, 38.0), Star.color = white }@@ -191,8 +192,7 @@ initLevels rt = do let b = blankArena 3000.0 3000.0- let a = b { stars = defaultStars- }+ let a = b let wmap = Universe.wrapMap a let pL = [ -- 1
Step.hs view
@@ -148,9 +148,7 @@ handleSound :: (Time, Universe) -> IO (Time, Universe) handleSound (t, u) = let arena' = arena u in- do let listenerCoords = case lance arena' of- Nothing -> lastFocus arena'- Just l -> Moving.center l+ do let listenerCoords = focus arena' lance' <- case lance arena' of Nothing -> return Nothing Just l -> do l' <- processAudio l listenerCoords@@ -271,12 +269,10 @@ (units ++ [updatedUnit], projectiles ++ nProjectiles) fixFocus (t, u) =- let arena' = arena u in- let oldFocus = lastFocus arena' in- let mFocus = do llance <- lance arena'- Just (Moving.center llance) in- let newFocus = fromMaybe oldFocus mFocus in- let u' = u { arena = arena' { lastFocus = newFocus } } in+ let a = arena u in+ let f = do l <- lance a+ Just (Moving.center l) in+ let u' = u { arena = a { focus = fromMaybe (focus a) f } } in (t, u') handleUpdatesCore :: (forall a. (InternallyUpdating a
Universe.hs view
@@ -14,8 +14,7 @@ import Sound.ALUT data Arena = Arena { lance :: Maybe Lance- , lastFocus :: WrapPoint- , stars :: [Star]+ , focus :: WrapPoint , wrapMap :: WrapMap , asteroids :: [SpaceJunk] , lanceProjectiles :: [Projectile]@@ -43,8 +42,7 @@ blankArena width height = let wmap = wrapmap width height in Arena { lance = Nothing- , lastFocus = wrappoint wmap (0, 0)- , stars = []+ , focus = wrappoint wmap (0, 0) , Universe.wrapMap = wmap , asteroids = [] , lanceProjectiles = []
edge.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.8.8+Version: 0.8.10 -- A short (one-line) description of the package. Synopsis: Top view space combat arcade game
edge.hs view
@@ -29,6 +29,7 @@ (concat (intersperse "," [ d | ALError _ d <- errs ])) else return ()+ playMusic (resourceTracker universe) playIO displayMode black 20 universe displayUniverse handleInput stepUniverse initUniverse =@@ -55,3 +56,10 @@ , blipSoundSource = Nothing } +playMusic rt =+ do [source] <- genObjectNames 1+ buffer source $= getSound rt "music.wav"+ sourceGain source $= 0.4+ loopingMode source $= Looping+ play [source]+
+ sound/music.wav view
file too large to diff
sound/simple-energy-shot.wav view
binary file changed (13440 → 13440 bytes)