edge 0.9.0.2 → 0.9.1.0
raw patch · 51 files changed
+891/−782 lines, 51 filesdep +OpenALdep ~glossnew-uploader
Dependencies added: OpenAL
Dependency ranges changed: gloss
Files
- AWS.hs +8/−0
- AfterEffect.hs +14/−3
- AfterEffect/MineExplosion.hs +15/−8
- AfterEffect/SimpleExplosion.hs +15/−8
- Animation.hs +15/−19
- Asteroid.hs +18/−11
- BigAsteroid.hs +17/−11
- Combat.hs +13/−13
- Common.hs +9/−3
- DONATE +0/−5
- Display.hs +32/−37
- Input.hs +12/−11
- Item.hs +14/−14
- Lance.hs +25/−23
- Main.hs +110/−0
- Math.hs +8/−0
- Moving.hs +14/−17
- Projectile/Blade.hs +17/−11
- Projectile/BulletMI.hs +19/−10
- Projectile/BulletMII.hs +19/−10
- Projectile/BulletMkI.hs +16/−7
- Projectile/BulletSI.hs +16/−7
- Projectile/BulletSII.hs +17/−8
- Projectile/Cannon.hs +17/−8
- Projectile/Interceptor.hs +19/−10
- Projectile/Mine.hs +17/−9
- Projectile/Nuke.hs +18/−11
- Projectile/Pellet.hs +17/−9
- Projectile/SWForward.hs +17/−9
- Projectile/SWSide.hs +17/−9
- ResourceTracker.hs +13/−0
- Resources.hs +21/−27
- SpaceJunk.hs +12/−9
- Star.hs +12/−2
- Step.hs +20/−35
- Unit.hs +13/−6
- Unit/Simple/Turret.hs +20/−13
- Unit/Smart/ATank.hs +18/−21
- Unit/Smart/Death.hs +15/−19
- Unit/Smart/DeathII.hs +14/−18
- Unit/Smart/Master.hs +20/−35
- Unit/Smart/Ninja.hs +20/−35
- Unit/Smart/STank.hs +18/−21
- Unit/Smart/Saucer.hs +18/−32
- Unit/Smart/Tank.hs +18/−21
- Unit/Smart/Zeus.hs +20/−32
- UnitUtil.hs +6/−5
- Universe.hs +20/−10
- Updating.hs +11/−1
- edge.cabal +17/−6
- edge.hs +0/−133
AWS.hs view
@@ -1,3 +1,11 @@+{-|+Module : AWS+Description : Defines screen resolution (Assumed Window Size)+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module AWS where -- |Assumed Window Size.
AfterEffect.hs view
@@ -1,10 +1,21 @@ {-# LANGUAGE ExistentialQuantification #-} +{-|+Module : AfterEffect+Description : Defines transient video or audio effects+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com++Defines visual or audio effects which are brief but not instantaneous.+-} module AfterEffect ( AfterEffect (..) ) where -import Animation (Audible(..), Animation(..))-import Updating (InternallyUpdating(..), Transient(..))-import Moving (Locatable(..))+import Prelude (return)++import Animation+import Updating+import Moving data AfterEffect = forall a. ( Animation a
AfterEffect/MineExplosion.hs view
@@ -1,17 +1,24 @@+{-|+Module : AfterEffect.MineExplosion+Description : Visual and audio after-effect from a mine explosion+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-} module AfterEffect.MineExplosion where +import Prelude (Maybe(..), (-), (+), return, (<), (<=)) import Data.WrapAround ( WP, WM )-import Animation ( Audible(..), Animation(..), procOneTimeSnd )-import Updating ( Transient(..), InternallyUpdating(..) )-import qualified Moving as M ( Locatable(..) )-import Graphics.Gloss.Data.Picture- ( Picture(Blank, Color, Scale, Text) )+import Graphics.Gloss.Data.Picture ( Picture(Blank, Color, Scale, Text) ) import Graphics.Gloss.Data.Color ( white ) import Sound.ALUT ( Source, stop ) import Data.Maybe ( isNothing, fromMaybe, fromJust )-import ResourceTracker ( RT, getImage )-import GHC.Float ()-import Common ( Time )++import Animation+import Updating+import qualified Moving as M ( Locatable(..) )+import ResourceTracker+import Common data MineExplosion = MineExplosion { center :: WP , timeRemaining :: Time
AfterEffect/SimpleExplosion.hs view
@@ -1,17 +1,24 @@+{-|+Module : AfterEffect.SimpleExplosion+Description : Defines a transient animation of something exploding+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-} module AfterEffect.SimpleExplosion where +import Prelude (Maybe(..), (-), (+), return, (<), (*), (<=)) import Data.WrapAround ( WP, WM )-import Animation ( Audible(..), Animation(..), procOneTimeSnd )-import Updating ( Transient(..), InternallyUpdating(..) )-import qualified Moving as M ( Locatable(..), newLocation )-import Graphics.Gloss.Data.Picture- ( Picture(Blank, Color, Scale, Text) )+import Graphics.Gloss.Data.Picture ( Picture(Blank, Color, Scale, Text) ) import Graphics.Gloss.Data.Color ( white ) import Sound.ALUT ( Source, stop ) import Data.Maybe ( isNothing, fromMaybe, fromJust )-import ResourceTracker ( RT, getImage )-import GHC.Float ()-import Common ( Velocity, Time )++import Animation+import Updating+import qualified Moving as M ( Locatable(..), newLocation )+import ResourceTracker+import Common data SimpleExplosion = SimpleExplosion { center :: WP , timeRemaining :: Time
Animation.hs view
@@ -1,28 +1,24 @@+{-|+Module : Animation+Description : Classes for animation objects and sound processing functions+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Animation where +import Prelude (Maybe(..), IO, ($), return, (>>=), (.), negate, (-), String, Float, Bool(..)) import Graphics.Gloss.Data.Picture (Picture(..)) import Data.WrapAround (WP, vectorRelation, WM, WP)-import Sound.ALUT ( DistanceModel(InverseDistanceClamped)- , Source- , ($=)- , play- , stop- , genObjectNames- , buffer- , sourcePosition- , Vertex3(..)- , sourceRelative- , referenceDistance- , rolloffFactor- , sourceGain- , SourceRelative(..)- )-import ResourceTracker (RT, getSound)-import Common (Time)+import Sound.ALUT (DistanceModel(InverseDistanceClamped), Source, ($=), play, stop, genObjectNames, buffer, sourcePosition, Vertex3(..), sourceRelative, referenceDistance, rolloffFactor, sourceGain, SourceRelative(..)) import GHC.Float ( double2Float )-import Math ( radToDeg )-import Moving (center, Locatable(..)) import Data.Maybe (isNothing, fromJust)++import ResourceTracker+import Common+import Math+import Moving class Animation a where image :: a -> Time -> Picture
Asteroid.hs view
@@ -1,19 +1,26 @@+{-|+Module : Asteroid+Description : Defines the asteroid game object+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Asteroid where -import Animation ( Animation(..) )-import Updating ( InternallyUpdating(..) )+import Prelude (const) import Graphics.Gloss.Data.Picture () import Graphics.Gloss.Data.Color ()-import Moving- ( Locatable, Colliding(collisionRadius), Moving, newLocation' )+import Data.WrapAround (WP, WM)++import Animation+import Updating+import Moving ( Locatable, Colliding(collisionRadius), Moving, newLocation' ) import qualified Moving as M ( Moving(..), Locatable(..) )-import Data.WrapAround ( WP, WM )-import ResourceTracker ( RT, ResourceTracker, protectedGetImage )-import GHC.Float ()-import Combat ( Damageable(..), Damaging(..) )-import Data.Maybe ()-import SpaceJunk ()-import Common ( Velocity )+import ResourceTracker+import Combat+import SpaceJunk+import Common radius = 15.0
BigAsteroid.hs view
@@ -1,19 +1,25 @@+{-|+Module : BigAsteroid+Description : Defines a larger asteroid object+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module BigAsteroid where -import Animation ( Animation(..) )-import Updating ( InternallyUpdating(..) )+import Prelude (const) import Graphics.Gloss.Data.Picture () import Graphics.Gloss.Data.Color ()-import Moving- ( Locatable, Colliding(collisionRadius), Moving, newLocation' )-import qualified Moving as M ( Moving(..), Locatable(..) ) import Data.WrapAround ( WP, WM )-import ResourceTracker ( RT, ResourceTracker, protectedGetImage )-import GHC.Float ()-import Combat ( Damageable(..), Damaging(..) )-import Data.Maybe ()-import SpaceJunk ()-import Common ( Velocity )++import Animation+import Updating+import Moving ( Locatable, Colliding(collisionRadius), Moving, newLocation' )+import qualified Moving as M ( Moving(..), Locatable(..) )+import ResourceTracker+import Combat+import Common radius = 30.0
Combat.hs view
@@ -1,21 +1,21 @@ {-# LANGUAGE ExistentialQuantification #-} +{-|+Module : Combat+Description : Handling the giving and receiving of damage+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Combat where -import Updating ( Transient (expired')- , InternallyUpdating ( preUpdate- , postUpdate- )- )-import Animation ( Animation )-import Moving ( Locatable ( center )- , Moving ( velocity )- , Colliding ( collisionRadius )- , collision- , collisionWindow- , collisionWindow'- )+import Prelude ((++), Maybe(..), Double) import Data.WrapAround ( WM )++import Updating+import Animation+import Moving data Projectile = forall a. ( Animation a , Colliding a
Common.hs view
@@ -1,8 +1,14 @@+{-|+Module : Common+Description : Some very generic functions and definitions+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Common where -import Math ( inc- , isNeg- )+import Math -- seconds type Time = Double
− DONATE
@@ -1,5 +0,0 @@-Care to support this free software project with a small donation? Visit:--https://frigidcode.com/donate-- -- Christopher Howard <christopher.howard@frigidcode.com>
Display.hs view
@@ -1,40 +1,35 @@ {-# LANGUAGE ExistentialQuantification #-} +{-|+Module : Display+Description : Translates the Universe into a Picture+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-} module Display (displayUniverse, AWS(..)) where -import Animation ( Animation(..) )+import Prelude ((/), (-), (+), (*), (<), map, (!!), (.), (++), fromIntegral, not, (&&), all, id, (==), max, Maybe(..), ($), show, (>=), Bool(..), undefined, (<=), abs, return)+import Data.Maybe ( isNothing, fromMaybe )+import Data.WrapAround ( wrapmap, vectorRelation )+import Graphics.Gloss.Interface.IO.Game ( Picture(Blank, Color, Line, Pictures, Polygon, Rotate, Scale, Text, Translate), yellow, white, red, green, cyan )+import GHC.Float ( double2Float )++import Animation import Universe- ( Arena(afterFX, asteroids, focus, items, lance, lanceProjectiles,- simpleUnits, smartUnits, unitProjectiles, wrapMap),- Universe(arena, aws, level, levelMessageTimer, lives,- panelActivationTimer, resourceTracker, startGameTimer) ) import Lance- ( Lance(currentWeapon, deflectorCharge, godMode, integrity,- inventory, swClock),- swTimeLimit )-import Data.Maybe ( isNothing, fromMaybe ) import Moving ( Locatable ) import qualified Moving as M ( Locatable(center) )-import Star ()-import Data.WrapAround ( wrapmap, vectorRelation )-import Graphics.Gloss.Interface.IO.Game- ( Picture(Blank, Color, Line, Pictures, Polygon, Rotate, Scale,- Text, Translate),- yellow,- white,- red,- green,- cyan )-import GHC.Float ( double2Float )-import Combat ( Projectile(Projectile) )-import AfterEffect ( AfterEffect(AfterEffect) )-import Unit ( SmartUnit(SmartUnit), SimpleUnit(SimpleUnit) )-import Item ( Item(Item), ItemType(Health) )-import ResourceTracker ( getImage )-import Math ( remF, appPair )-import Resources ( stars )-import Common ()-import AWS ( AWS(..) )+import Star+import Combat+import AfterEffect+import Unit+import Item+import ResourceTracker+import Math+import Resources+import Common+import AWS data Displayable = forall a. (Locatable a, Animation a) => Displayable a @@ -99,7 +94,7 @@ , g (Translate (am (-400)) (ap 340) (inventoryDisplay (lance r) (resourceTracker u))) , g (Translate (-200) 150 (levelMessage (levelMessageTimer u) (level u)))- , h 2.5 (i 20 (Translate (ap (220)) (am (-300)) helpColumn3))+ -- , h 2.5 (i 20 (Translate (ap (220)) (am (-300)) helpColumn3)) , h 2 (i 20 (Translate (am (-450)) (am (-230)) helpColumn2)) , h 2 (i 20 (Translate (am (-470)) (am (-320)) helpColumn1)) ]@@ -157,13 +152,13 @@ , "SPACEBAR, ENTER for deflector" ] -helpColumn3 =- Color white $- Pictures $- lineFormatting- [ "Enjoy the game? To donate"- , "visit <frigidcode.com/donate>."- ]+-- helpColumn3 =+-- Color white $+-- Pictures $+-- lineFormatting+-- [ "Enjoy the game? To donate"+-- , "visit <frigidcode.com/donate>."+-- ] lineFormatting ys = lineFormatting' 20 0 ys
Input.hs view
@@ -1,17 +1,18 @@+{-|+Module : Input+Description : Handles input events such as keystrokes+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Input where -import Universe ( Arena(lance), Universe(arena, skipLevel) )-import Graphics.Gloss.Interface.IO.Game- ( Event(EventKey),- SpecialKey(KeyEnter, KeyLeft, KeyRight, KeySpace, KeyTab, KeyUp),- Modifiers(Modifiers, alt, ctrl, shift),- KeyState(Down, Up),- Key(Char, SpecialKey) )+import Prelude (Bool(..), Maybe(..), return, IO, map)+import Graphics.Gloss.Interface.IO.Game ( Event(EventKey), SpecialKey(KeyEnter, KeyLeft, KeyRight, KeySpace, KeyTab, KeyUp), Modifiers(Modifiers, alt, ctrl, shift), KeyState(Down, Up), Key(Char, SpecialKey) )++import Universe import Lance- ( Lance(deflector, fireTrigger, godMode, inventory,- linearThrusters, rotationalThrusters, swClock),- RotationDirection(CCW, CW, Stable),- changeCurrentWeapon ) handleInput :: Event -> Universe -> IO Universe
Item.hs view
@@ -1,23 +1,23 @@+{-|+Module : Item+Description : Defines objects that can be picked up by the space ship+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Item where +import Prelude (($), return, Int, IO, Show, Eq) import Data.WrapAround (WP)-import Moving ( Moving (velocity)- , Locatable (center)- , Colliding (collisionRadius)- )-import Animation ( Animation(..) ) import Data.Maybe (fromMaybe)-import Graphics.Gloss.Data.Picture ( Picture ( Scale- , Color- , Text- )- )+import Graphics.Gloss.Data.Picture ( Picture ( Scale, Color, Text)) import Graphics.Gloss.Data.Color (white)-import ResourceTracker ( RT- , getImage- , protectedGetImage- ) import System.Random (randomRIO)++import Moving+import Animation+import ResourceTracker data ItemType = Health | FourWay
Lance.hs view
@@ -1,3 +1,11 @@+{-|+Module : Lance+Description : Defines and manipulates the user\'s space ship+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Lance ( Lance ( rotationalThrusters , linearThrusters , deflector@@ -20,35 +28,29 @@ , swTimeLimit ) where +import Prelude (not, (||), (<), (-), (<=), Maybe(..), (*), min, (+), (*), otherwise, (>), (&&), Bool(..), max, (++), (>=), pi, (/), map, (.), (!!), (==), Eq, Int, Double) import Data.WrapAround ( WP, WM )-import Animation ( Animation(..)- , Audible(..)- , handSndSrc- , termSndSrc- , reorient ) import Graphics.Gloss.Data.Picture (Picture(..)) import Graphics.Gloss.Data.Color (white) import GHC.Float (double2Float)-import Math (isZero, dec, inc, neither, remF)-import ResourceTracker (RT, protectedGetImage, getImage) import Data.Maybe (fromMaybe)-import Updating (Transient(..), InternallyUpdating(..))-import qualified Moving as M ( Locatable(..)- , Moving(..)- , Colliding(..)- , newLocation'- , newVelocity )-import Combat (Damageable(..), Launcher(..), Damaging(..), Projectile(..))-import qualified Projectile.BulletMkI as P.BulletMkI (new)-import qualified Projectile.Cannon as P.Cannon (new)-import qualified Projectile.Nuke as P.Nuke (new)-import qualified Projectile.SWSide as P.SWSide (new)-import qualified Projectile.SWForward as P.SWForward (new)-import AfterEffect (AfterEffect(..))-import qualified AfterEffect.SimpleExplosion as SimpleExplosion (new) import Sound.ALUT (Source(..))-import Item (Item(..), ItemType(..))-import Common (Angle, Velocity, Time, replaceAt, allTrue)++import Animation+import Math+import ResourceTracker+import Updating+import qualified Moving as M+import Combat+import qualified Projectile.BulletMkI as P.BulletMkI+import qualified Projectile.Cannon as P.Cannon+import qualified Projectile.Nuke as P.Nuke+import qualified Projectile.SWSide as P.SWSide+import qualified Projectile.SWForward as P.SWForward+import AfterEffect+import qualified AfterEffect.SimpleExplosion as SimpleExplosion+import Item+import Common radialVelocity = pi -- radians per second
+ Main.hs view
@@ -0,0 +1,110 @@+{-|+Module : Main+Description : top level executable module+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}++module Main where++import Prelude (putStrLn, IO, String, Maybe(..), null, head, ($), return, Bool(..), not)+import Text.Show ( Show )+import System.IO.Error ( userError, ioError )+import Data.WrapAround ( wrappoint )+import Graphics.Gloss.Interface.IO.Game ( black, Display(FullScreen), playIO )+import Sound.ALUT ( HasSetter(($=)), HasGetter(get), LoopingMode(Looping), ALError(ALError), ObjectName(genObjectNames), sourceGain, play, loopingMode, buffer, alErrors, distanceModel, withProgNameAndArgs, runALUT )+import System.IO ( stderr, hPutStrLn )+import Data.List ( intersperse, concat )+import System.Console.CmdTheLine (TermInfo(termName, version), OptInfo(optDoc), run, defTI, value, optInfo, opt)+import Control.Applicative ( (<$>) )+import Data.Version ( showVersion )++import qualified Paths_edge as P ( version )+import Resources+import Display+import Step+import Lance+import Input+import Universe+import AWS+import Unit+import Unit.Simple.Turret+import ResourceTracker+import Animation++displayMode a = FullScreen a++data EdgeOpts = EdgeOpts { size :: Maybe AWS }+ deriving Show++switchboard :: String -> IO ()+switchboard size =+ case size of+ "default" -> edge W1024+ "1024x768" -> edge W1024+ "1280x1024" -> edge W1280+ otherwise -> do putStrLn "Invalid resolution, defaulting to 1024x768"+ edge W1024++sizeFl = value (opt "1024x768"+ ((optInfo [ "size", "s" ])+ { optDoc = "resolution: supports 1024x768 or 1280x1024." }+ ))++term = switchboard <$> sizeFl++termInfo = defTI { termName = "edge", version = showVersion P.version }++main = run (term, termInfo)++edge a =+ do withProgNameAndArgs runALUT $ \_ _ ->+ do universe <- initUniverse a+ distanceModel $= audioDistanceModel+ errs <- get alErrors+ if not (null errs)+ then hPutStrLn+ stderr+ (concat+ (intersperse "," [ d | ALError _ d <- errs ]))+ else return ()+ playMusic (resourceTracker universe)+ playIO+ (displayMode (case a of+ W1024 -> (1024, 768)+ W1280 -> (1280, 1024)))+ black 20 universe displayUniverse handleInput stepUniverse++initUniverse b =+ do rt <- initResources+ rLevels <- initLevels rt+ let sArena = head rLevels+ let wmap = Universe.wrapMap sArena+ return Universe { arena = sArena++ { lance = Just (Lance.new rt wmap+ (wrappoint wmap (0, 0)))+ }++ , level = 0+ , Universe.levels = rLevels+ , lives = 3+ , delayRemaining = 2.0+ , resourceTracker = rt+ , skipLevel = False+ , levelMessageTimer = Nothing+ , panelActivationTimer = 0.0+ , startGameTimer = 0.0+ , queueBlipSound = True+ , blipSoundSource = Nothing+ , aws = b+ }++playMusic rt =+ do [source] <- genObjectNames 1+ buffer source $= getSound rt "music.wav"+ sourceGain source $= 0.4+ loopingMode source $= Looping+ play [source]+
Math.hs view
@@ -1,3 +1,11 @@+{-|+Module : Math+Description : Mathematical functions+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Math where divBySum a b c = a / (b + c)
Moving.hs view
@@ -1,26 +1,23 @@+{-|+Module : Moving+Description : Movement calculation+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Moving where -import Data.WrapAround ( WM- , WP- , add'- )+import Prelude ((<=), max, (*), Maybe(..), map, (.), ceiling, (/), zip3, Double, Bool(..), (+), sin, asin, pi, (-), min, fromIntegral, cos, Floating)+import Data.WrapAround ( WM, WP, add' ) import qualified Data.WrapAround as W (distance)-import Math ( mulSV- , vectMag- , isPos- , divideProduct- , mulSV- , addV- , zeroProtect- )-import qualified Math as T (distance) import Data.List (find) import Control.Monad (join)-import Common ( Velocity- , Angle- , Time- ) import Data.Maybe (isJust)++import Math ( mulSV, vectMag, isPos, divideProduct, mulSV, addV, zeroProtect )+import qualified Math as T (distance)+import Common maxExpectedVelocity = 700 -- should equal max velocity of fastest object in arena
Projectile/Blade.hs view
@@ -1,23 +1,29 @@+{-|+Module : Projectile.Blade+Description : Spinning blade projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.Blade ( Blade(..) , new- -- , prj , speed ) where -import Combat ( Damageable(..), Damaging(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude ((.), (+), max, (-), Maybe(..), pi, (*), Double, ($), cos, sin) import Graphics.Gloss.Data.Picture ( Picture(Color, Line, Rotate) ) import Graphics.Gloss.Data.Color ( white ) import Data.WrapAround ( WP, WM, distance )-import qualified Moving as M- ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Time )-import Math ( radToDeg, remF, appPair, zeroOrLess ) import GHC.Float ( double2Float ) import Data.Maybe ( fromMaybe )-import ResourceTracker ( getImage, RT )+import Combat+import Animation+import Updating+import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newLocation )+import Common+import Math+import ResourceTracker velocityC = 250 @@ -79,7 +85,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wmap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wmap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wmap s) (center s) a) instance Damaging Blade where
Projectile/BulletMI.hs view
@@ -1,20 +1,29 @@+{-|+Module : Projectile.BulletMI+Description : Bullet projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.BulletMI ( BulletMI(..) , new , prj ) where -import Combat ( Damageable(..), Damaging(..), Projectile(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude ((+), max, (-), (||), Maybe(..), Bool(..), ($), cos, sin, (.), (<), otherwise, (*), Double) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) )-import Graphics.Gloss.Data.Color ( yellow, red )+import Graphics.Gloss.Data.Color ( yellow, red, green ) import Data.WrapAround ( WP, WM, distance )+import GHC.Float (double2Float)++import Combat+import Animation+import Updating import qualified Moving as M- ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Angle, Time )-import Math ( appPair, remF, zeroOrLess, moreThanZero )-import GHC.Float ( double2Float )+ ( Moving(..), Locatable(..), Colliding(..), newLocation )+import Common+import Math velocityC = 400.0 @@ -74,7 +83,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) instance Damaging BulletMI where
Projectile/BulletMII.hs view
@@ -1,20 +1,29 @@+{-|+Module : Projectile.BulletMII+Description : Bullet projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.BulletMII ( BulletMII(..) , new , prj ) where -import Combat ( Damageable(..), Damaging(..), Projectile(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude ((+), max, (-), (||), Maybe(..), Bool(..), ($), cos, sin, (.), (<), otherwise, (*), Double) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) )-import Graphics.Gloss.Data.Color ( yellow, red )+import Graphics.Gloss.Data.Color ( yellow, red, green ) import Data.WrapAround ( WP, WM, distance )+import GHC.Float (double2Float)++import Combat+import Animation+import Updating import qualified Moving as M- ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Angle, Time )-import Math ( appPair, remF, zeroOrLess, moreThanZero )-import GHC.Float ( double2Float )+ ( Moving(..), Locatable(..), Colliding(..), newLocation )+import Common+import Math velocityC = 400.0 @@ -74,7 +83,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) instance Damaging BulletMII where
Projectile/BulletMkI.hs view
@@ -1,19 +1,28 @@+{-|+Module : Projectile.BulletMkI+Description : Bullet projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.BulletMkI ( BulletMkI(..) , new , prj ) where -import Combat ( Damageable(..), Damaging(..), Projectile(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude (max, (-), (||), Maybe (..), Bool(..), cos, sin, (.), (<), otherwise, (.), (+), Double, (*), ($)) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) ) import Graphics.Gloss.Data.Color ( cyan, blue ) import Data.WrapAround ( WP, WM, distance )++import Combat+import Animation+import Updating import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Angle, Time )-import Math ( appPair, remF, zeroOrLess, moreThanZero )+import Common+import Math velocityC = 700.0 @@ -71,7 +80,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) instance Damaging BulletMkI where
Projectile/BulletSI.hs view
@@ -1,19 +1,28 @@+{-|+Module : Projectile.BulletSI+Description : Bullet projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.BulletSI ( BulletSI(..) , new , prj ) where -import Combat ( Projectile(..), Damaging(..), Damageable(..) )-import Animation ( Animation(..) )-import Updating- ( Transient(..), SimpleTransient(..), InternallyUpdating(..) )+import Prelude ((+), max, (-), (||), Maybe(..), Bool(..), ($), cos, sin, (.), (<), otherwise, (*), Double) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) ) import Graphics.Gloss.Data.Color ( yellow, red ) import Data.WrapAround ( WP, WM, distance )++import Combat+import Animation+import Updating import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newLocation )-import Common ( Velocity, Time, Angle )-import Math ( appPair, remF, zeroOrLess, moreThanZero )+import Common+import Math velocityC = 400.0 @@ -71,7 +80,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) instance Damaging BulletSI where
Projectile/BulletSII.hs view
@@ -1,20 +1,29 @@+{-|+Module : Projectile.BulletSII+Description : Bullet projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.BulletSII ( BulletSII(..) , new , prj , speed ) where -import Combat ( Projectile(..), Damaging(..), Damageable(..) )-import Animation ( Animation(..) )-import Updating- ( Transient(..), SimpleTransient(..), InternallyUpdating(..) )+import Prelude ((+), max, (-), (||), Maybe(..), Bool(..), ($), cos, sin, (.), (<), otherwise, (*), Double) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) )-import Graphics.Gloss.Data.Color ( yellow, green )+import Graphics.Gloss.Data.Color ( yellow, red, green ) import Data.WrapAround ( WP, WM, distance )++import Combat+import Animation+import Updating import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newLocation )-import Common ( Velocity, Time, Angle )-import Math ( appPair, remF, zeroOrLess, moreThanZero )+import Common+import Math speed = velocityC @@ -74,7 +83,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) instance Damaging BulletSII where
Projectile/Cannon.hs view
@@ -1,20 +1,29 @@+{-|+Module : Projectile.Cannon+Description : Cannon projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.Cannon ( Cannon(..) , new , prj ) where -import Combat ( Damageable(..), Damaging(..), Projectile(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude ((.), (+), max, (-), Maybe(..), (*), ($), cos, sin, (<), otherwise, (||), Double, Bool(..)) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) ) import Graphics.Gloss.Data.Color ( cyan, blue ) import Data.WrapAround ( WP, WM, distance )++import Combat+import Animation+import Updating import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Angle, Time )-import Math ( remF, appPair, zeroOrLess )-import GHC.Float ( double2Float )+import Common+import Math+import GHC.Float velocityC = 500.0 @@ -78,7 +87,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) instance Damaging Cannon where
Projectile/Interceptor.hs view
@@ -1,24 +1,33 @@+{-|+Module : Interceptor+Description : Interceptor projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.Interceptor ( Interceptor(..) , new -- , prj , speed ) where -import Combat ( Damageable(..), Damaging(..) )-import Animation ( Animation(..), reorient )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude ((-), (||), (.), Maybe(..), Bool(..), (*), ($), cos, sin, (>), (+), max, Double) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) ) import Graphics.Gloss.Data.Color ( white ) import Data.WrapAround ( WP, WM, distance )-import qualified Moving as M- ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Angle, Time )-import Math ( remF, appPair, zeroOrLess, moreThanZero ) import GHC.Float ( double2Float )-import ResourceTracker ( RT, getImage ) import Data.Maybe ( fromMaybe ) +import Combat+import Animation+import Updating+import qualified Moving as M+ ( Colliding(..), Moving(..), Locatable(..), newLocation )+import Common+import Math+import ResourceTracker+ velocityC = 900 rangeC = 1200@@ -84,7 +93,7 @@ postUpdate s t = s { center = a, rangeLeft = r } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) instance Damaging Interceptor where
Projectile/Mine.hs view
@@ -1,22 +1,30 @@+{-|+Module : Projectile.Mine+Description : Mine projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.Mine ( Mine(..) , new ) where -import Combat ( Damageable(..), Damaging(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude ((>), (&&), (<=), (+), Maybe(..), ($), Bool(..), (||)) import Graphics.Gloss.Data.Picture () import Graphics.Gloss.Data.Color () import Data.WrapAround ( WP, WM )++import Combat+import Animation+import Updating import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..) )-import ResourceTracker ( RT, ResourceTracker, protectedGetImage )-import Data.Maybe ()+import ResourceTracker import qualified AfterEffect.MineExplosion as MineExplosion ( new )-import AfterEffect ( AfterEffect(AfterEffect) )-import Common ( Time )-import Math ( remF, appPair, moreThanZero )+import AfterEffect+import Common+import Math detRadius = 100 punch = 1
Projectile/Nuke.hs view
@@ -1,21 +1,28 @@+{-|+Module : Projectile.Nuke+Description : Tactical nuclear projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.Nuke ( Nuke(..) , new ) where -import Combat ( Damaging(..), Damageable(..) )-import Animation ( Animation(..) )-import Updating- ( Transient(..), SimpleTransient(..), InternallyUpdating(..) )-import Graphics.Gloss.Data.Picture- ( Picture(Blank, Circle, Color, Scale) )+import Prelude ((+), (>=), (<), Maybe(..), Bool(..), (*), (.), ($), cos, sin)+import Graphics.Gloss.Data.Picture ( Picture(Blank, Circle, Color, Scale) ) import Graphics.Gloss.Data.Color ( white, green ) import Data.WrapAround ( WP, WM )-import qualified Moving as M- ( Moving(..), Locatable(..), Colliding(..), newLocation )-import ResourceTracker ( ResourceTracker, RT, getImage ) import Data.Maybe ( fromMaybe )-import Common ( Velocity, Time, Angle )-import Math ( appPair )++import Combat+import Animation+import Updating+import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newLocation )+import ResourceTracker+import Common+import Math velocityC = 200.0 punch = 8.0
Projectile/Pellet.hs view
@@ -1,19 +1,27 @@+{-|+Module : Projectile.Pellet+Description : Very small bullet+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.Pellet ( Pellet(..) , new , range ) where -import Combat ( Damaging(..), Damageable(..) )-import Animation ( Animation(..) )-import Updating- ( Transient(..), SimpleTransient(..), InternallyUpdating(..) )+import Prelude ((||), (.), max, (-), Maybe(..), Bool(..), Double) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) ) import Graphics.Gloss.Data.Color ( makeColor8 )++import Combat+import Animation+import Updating import Data.WrapAround ( WP, WM, distance )-import qualified Moving as M- ( Moving(..), Locatable(..), Colliding(..), newLocation )-import Common ( Velocity, Angle )-import Math ( vecCoord, addV, zeroOrLess, moreThanZero )+import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newLocation )+import Common+import Math velocityC = 600 rangeC = 300@@ -65,7 +73,7 @@ postUpdate s t = s { center = a- , rangeLeft = max 0 (rangeLeft s - distance (wmap s) (center s) a)+ , rangeLeft = max 0 (rangeLeft s - Data.WrapAround.distance (wmap s) (center s) a) } where a = M.newLocation (wmap s) (center s) (velocity s) t
Projectile/SWForward.hs view
@@ -1,21 +1,29 @@+{-|+Module : Projectile.SWForward+Description : Growing super weapon projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.SWForward ( SWForward(..) , new , prj ) where -import Combat ( Damageable(..), Damaging(..), Projectile(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude (min, (+), (*), Maybe(..), (-), ($), cos, (||), (.), Double, Bool(..), sin, max) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) ) import Graphics.Gloss.Data.Color ( violet ) import Data.WrapAround ( WP, WM, distance )-import qualified Moving as M- ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Angle, Time )-import Math ( appPair, zeroOrLess ) import GHC.Float ( double2Float ) +import Combat+import Animation+import Updating+import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newLocation )+import Common+import Math+ velocityC = 700 rangeC = 1000@@ -77,7 +85,7 @@ postUpdate s t = s { center = a, rangeLeft = r, radius = q } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) q = min 128.0 ((radius s) + radiusGrowth * t) instance Damaging SWForward where
Projectile/SWSide.hs view
@@ -1,21 +1,29 @@+{-|+Module : Projectile.SWSide+Description : Growing super weapon projectile+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Projectile.SWSide ( SWSide(..) , new , prj ) where -import Combat ( Damageable(..), Damaging(..), Projectile(..) )-import Animation ( Animation(..) )-import Updating- ( SimpleTransient(..), Transient(..), InternallyUpdating(..) )+import Prelude (min, (+), (*), Maybe(..), (-), ($), cos, (||), (.), Double, Bool(..), sin, max) import Graphics.Gloss.Data.Picture ( Picture(Circle, Color) ) import Graphics.Gloss.Data.Color ( cyan ) import Data.WrapAround ( WP, WM, distance )-import qualified Moving as M- ( Colliding(..), Moving(..), Locatable(..), newLocation )-import Common ( Velocity, Angle, Time )-import Math ( appPair, zeroOrLess ) import GHC.Float ( double2Float ) +import Combat+import Animation+import Updating+import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newLocation )+import Common+import Math+ velocityC = 700.0 rangeC = 1000.0@@ -77,7 +85,7 @@ postUpdate s t = s { center = a, rangeLeft = r, radius = q } where a = M.newLocation (wrapMap s) (center s) (velocity s) t- r = max 0 (rangeLeft s - distance (wrapMap s) (center s) a)+ r = max 0 (rangeLeft s - Data.WrapAround.distance (wrapMap s) (center s) a) q = min 128.0 ((radius s) + radiusGrowth * t) instance Damaging SWSide where
ResourceTracker.hs view
@@ -1,3 +1,15 @@+{-|+Module : ResourcesTracker+Description : Stores image and sound resources for use in the program+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com++Resources (images and sounds) are preloaded into the resource tracker,+so that the rt can be passed into objects, rather than requiring each+object to load its own resources from disk.+-}+ module ResourceTracker ( ResourceTracker() , RT , emptyResourceTracker@@ -8,6 +20,7 @@ , protectedGetImage ) where +import Prelude (String, Show) import Graphics.Gloss.Data.Picture ( Picture(..) ) import Graphics.Gloss.Data.Color ( white ) import Data.Map ( Map, empty, insert )
Resources.hs view
@@ -1,33 +1,28 @@+{-|+Module : Resources+Description : Preloading and initialization of various game resources+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Resources where -import Paths_edge ( getDataFileName )+import Prelude (map, return, (==), mapM, (++), pi, (+), (/), (*), zip, (.), foldr, ($)) import Graphics.Gloss.Data.Picture ( loadBMP )-import Graphics.Gloss.Data.Color- ( yellow,- white,- violet,- rose,- orange,- magenta,- green,- cyan,- chartreuse,- blue,- azure,- aquamarine )+import Graphics.Gloss.Data.Color ( yellow, white, violet, rose, orange, magenta, green, cyan, chartreuse, blue, azure, aquamarine )+import Data.WrapAround ( wrappoint, wm )+import Sound.ALUT ( SoundDataSource(File), createBuffer )+import System.Random ( Random(randomRIO) )++import Paths_edge ( getDataFileName ) import ResourceTracker- ( emptyResourceTracker, storeImage, storeSound )-import SpaceJunk ( SpaceJunk(SpaceJunk) )+import SpaceJunk import qualified Asteroid as Asteroid ( new ) import qualified BigAsteroid as BigAsteroid ( new )-import Data.WrapAround ( wrappoint, wm )-import Star ( Star(Star, color, location) )-import Sound.ALUT ( SoundDataSource(File), createBuffer )+import Star import Universe- ( Arena(asteroids, items, simpleUnits, smartUnits, unitProjectiles,- wrapMap),- blankArena )-import Unit ( SmartUnit(SmartUnit), SimpleUnit(SimpleUnit) )+import Unit import qualified Unit.Simple.Turret as Turret ( new ) import qualified Unit.Smart.Tank as Tank ( new ) import qualified Unit.Smart.ATank as ATank ( new )@@ -39,11 +34,10 @@ import qualified Unit.Smart.Saucer as Saucer ( new ) import qualified Unit.Smart.Sniper as Sniper ( new ) import qualified Unit.Smart.Zeus as Zeus ( new )-import Combat ( Projectile(Projectile) )+import Combat import qualified Projectile.Mine as Mine ( new )-import Item ( Item(Item), randomItemType )-import System.Random ( Random(randomRIO) )-import Math ( qArc )+import Item+import Math initResources = let imageFiles = [ "asteroid.bmp" , "asteroidbig.bmp"
SpaceJunk.hs view
@@ -1,16 +1,19 @@ {-# LANGUAGE ExistentialQuantification #-} +{-|+Module : SpaceJunk+Description : Defines non-hostile but damaging space objects+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-} module SpaceJunk where -import Animation ( Animation (..) )-import Updating ( InternallyUpdating (..) )-import Moving ( Colliding (..)- , Moving (..)- , Locatable (..)- )-import Combat ( Damaging (..)- , Damageable (..)- )+import Prelude ()+import Animation+import Updating+import Moving+import Combat data SpaceJunk = forall a. ( InternallyUpdating a , Colliding a
Star.hs view
@@ -1,10 +1,20 @@+{-|+Module : Star+Description : Defines the Star backdrop object+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Star where +import Prelude () import Data.WrapAround (WP)-import Animation (Animation(..)) import Graphics.Gloss.Data.Picture (rectangleSolid, Picture(..)) import Graphics.Gloss.Data.Color (Color)-import Moving (Locatable(..))++import Animation+import Moving data Star = Star { location :: WP , color :: Color
Step.hs view
@@ -1,49 +1,34 @@ {-# LANGUAGE ExistentialQuantification, Rank2Types #-} +{-|+Module : Step+Description : Updating Universe state at each step iteration+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-} module Step (stepUniverse) where +import Prelude ((.), (++), Maybe(..), not, max, (*), (+), foldr, (-), (&&), return, Bool(..), (>), IO, mapM, ($), fmap, (!!), otherwise, map, length, (>=), null, head, Float)+import Data.WrapAround ( wrappoint )+import GHC.Float ( float2Double )+import Data.Maybe ( fromMaybe, isNothing, fromJust, isJust )+import Control.Monad ( (>=>) )+import Sound.ALUT ( HasSetter(($=)), ObjectName(genObjectNames), play, buffer )+ import Universe- ( Arena(afterFX, asteroids, focus, items, lance, lanceProjectiles,- simpleUnits, smartUnits, unitProjectiles, wrapMap),- Universe(arena, blipSoundSource, delayRemaining, level,- levelMessageTimer, lives, panelActivationTimer, queueBlipSound,- resourceTracker, skipLevel, startGameTimer, levels) )-import SpaceJunk ()+import SpaceJunk import Moving- ( Colliding(collisionRadius),- Locatable(center),- maxExpectedVelocity,- collision,- collisionWindow )-import Data.WrapAround ( wrappoint ) import Updating- ( Observant(updateVision),- Transient(expired'),- InternallyUpdating(..) )-import GHC.Float ( float2Double ) import Lance- ( Lance(angle, godMode, inventory, swClock, center, velocity),- new,- processItem )-import Data.List () import Combat- ( Launcher(deployProjectiles),- Projectile(Projectile),- handleCollisionDamage,- handleCollisionDamage' )-import Data.Maybe ( fromMaybe, isNothing, fromJust, isJust ) import AfterEffect ( AfterEffect(AfterEffect) ) import qualified AfterEffect.SimpleExplosion as SimpleExplosion ()-import Unit ()-import Animation ( Audible(processAudio) )-import Control.Monad ( (>=>) )-import System.IO ()-import System.Exit ()-import Resources ( initLevels )-import Sound.ALUT- ( HasSetter(($=)), ObjectName(genObjectNames), play, buffer )-import Common ( Time )-import ResourceTracker ( getSound )+import Unit+import Animation+import Resources+import Common+import ResourceTracker delayOnDeath = 4.0
Unit.hs view
@@ -1,18 +1,25 @@ {-# LANGUAGE ExistentialQuantification #-} +{-|+Module : Unit+Description : Combatants+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit ( SimpleUnit (..) , SmartUnit (..) , firing ) where -import Animation ( Audible(..), Animation(..) )-import Moving ( Locatable(..), Colliding(..), Moving(..) )+import Prelude (return, Bool(..), (>=), (++), (+))+import Animation+import Moving import Combat- ( Damaging(..), Damageable(..), Launcher(..), Projectile ) import Updating- ( Transient(..), InternallyUpdating(..), Observant(..) )-import Common ( Time )-import Data.Maybe ()+import Common+ -- Simple, i.e., no sensory awareness and related A.I. data SimpleUnit = forall a. ( Animation a , Colliding a
Unit/Simple/Turret.hs view
@@ -1,23 +1,30 @@+{-|+Module : Unit.Simple.Turret+Description : Fixed gun turret which rotates while firing+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Simple.Turret ( Turret(..) , new ) where +import Prelude ((+), (>), Maybe(..), max, (-), (/), pi, (*), sin, cos, Bool(..), (.), Double, map) import Data.WrapAround (WP, WM)-import Animation (Audible(..), Animation(..), handSndSrc, termSndSrc, reorient)-import Math (appPair)-import ResourceTracker (RT, protectedGetImage)-import Updating (InternallyUpdating(..), Transient(..))-import qualified Moving as M (Locatable(..)- , Moving(..)- , Colliding(..)- , newLocation')-import Combat (Launcher(..), Damageable(..), Damaging(..), Projectile(..))+import Sound.ALUT (Source(..))++import Animation+import Math+import ResourceTracker+import Updating+import qualified Moving as M (Locatable(..), Moving(..), Colliding(..), newLocation')+import Combat import qualified Projectile.BulletSI as P.BulletSI (prj)-import AfterEffect (AfterEffect(..))+import AfterEffect import qualified AfterEffect.SimpleExplosion as SimpleExplosion (new)-import Sound.ALUT (Source(..))-import Common (Angle, Velocity, Time)-import Unit (firing)+import Common+import Unit radVelocity = pi/6 -- radians per second
Unit/Smart/ATank.hs view
@@ -1,36 +1,33 @@+{-|+Module : Unit.Smart.ATank+Description : Advanced tank+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.ATank ( ATank(..) , new ) where +import Prelude ((.), Maybe(..), max, (-), pi, Bool(..), (/), Double) import Data.WrapAround ( WP, WM )+import Sound.ALUT ( Source )+ import Animation- ( Audible(..), Animation(..), termSndSrc, reorient, handSndSrc )-import Graphics.Gloss.Data.Picture ()-import Graphics.Gloss.Data.Color ()-import GHC.Float ()-import Math ( moreThanZero )-import ResourceTracker ( ResourceTracker, protectedGetImage )+import Math+import ResourceTracker import Updating- ( Transient(..), Observant(..), InternallyUpdating(..) )-import qualified Moving as M- ( Moving(..),- Locatable(..),- Colliding(..),- newVelocity,- newLocation )+import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newVelocity, newLocation ) import Combat- ( Projectile, Launcher(..), Damaging(..), Damageable(..) ) import qualified Projectile.BulletMI as P.BulletMI ( prj ) import AfterEffect ( AfterEffect(AfterEffect) )-import qualified AfterEffect.SimpleExplosion as SimpleExplosion- ( new )-import Data.Maybe ()+import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new ) import Universe ( Arena ) import qualified Universe as U ()-import Sound.ALUT ( Source )-import Common ( Velocity, Time, Angle )-import UnitUtil ( adjAngle, firingAngle )-import Unit ( firing )+import Common+import UnitUtil+import Unit radialVelocity = pi/4 maxVelocityMag = 60
Unit/Smart/Death.hs view
@@ -1,37 +1,33 @@+{-|+Module : Unit.Smart.Death+Description : Death boss unit+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.Death ( Death(..) , new ) where +import Prelude (Maybe(..), max, (-), (*), pi, (/), (+), (++), map, Bool(..), (.), fst, (>=), (>), (<), otherwise, abs, Double, (<=))+import Sound.ALUT ( Source )+ import Data.WrapAround ( WP, WM, vectorRelation )-import Animation- ( Audible(..), Animation(..), termSndSrc, handSndSrc )-import Graphics.Gloss.Data.Picture ()-import Graphics.Gloss.Data.Color ()-import GHC.Float ()+import Animation ( Audible(..), Animation(..), termSndSrc, handSndSrc ) import Math- ( vectorDirection, targetingA, subV, moreThanZero, isNan )-import ResourceTracker ( RT, protectedGetImage )+import ResourceTracker import Updating- ( Transient(..), Observant(..), InternallyUpdating(..) )-import qualified Moving as M- ( Moving(..),- Locatable(..),- Colliding(..),- newVelocity,- newLocation )+import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newVelocity, newLocation ) import Combat- ( Projectile(..), Launcher(..), Damaging(..), Damageable(..) ) import qualified Projectile.BulletSII as P.BulletSII ( speed, new ) import qualified Projectile.BulletMII as P.BulletMII ( new ) import AfterEffect ( AfterEffect(AfterEffect) ) import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new )-import Data.Maybe () import Universe ( Arena(lance) ) import qualified Universe as U ( Arena(wrapMap) )-import Sound.ALUT ( Source )-import Common ( Velocity, Time, Angle )-+import Common radialVelocity = pi maxVelocityMag = 200
Unit/Smart/DeathII.hs view
@@ -1,37 +1,33 @@+{-|+Module : Unit.Smart.DeathII+Description : Upgraded Death boss character!+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.DeathII ( DeathII(..) , new ) where +import Prelude (Maybe(..), max, (-), (*), pi, (/), (+), (++), map, Bool(..), (.), fst, (>=), (>), (<), otherwise, abs, Double, (<=))+import Sound.ALUT ( Source ) import Data.WrapAround ( WP, WM, vectorRelation )+ import Animation- ( Audible(..), Animation(..), termSndSrc, handSndSrc )-import Graphics.Gloss.Data.Picture ()-import Graphics.Gloss.Data.Color ()-import GHC.Float () import Math- ( vectorDirection, targetingA, subV, moreThanZero, isNan )-import ResourceTracker ( RT, protectedGetImage )+import ResourceTracker import Updating- ( Transient(..), Observant(..), InternallyUpdating(..) )-import qualified Moving as M- ( Moving(..),- Locatable(..),- Colliding(..),- newVelocity,- newLocation )+import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newVelocity, newLocation ) import Combat- ( Projectile(..), Launcher(..), Damaging(..), Damageable(..) ) import qualified Projectile.Interceptor as P.Interceptor ( speed, new ) import qualified Projectile.BulletMII as P.BulletMII ( new ) import AfterEffect ( AfterEffect(AfterEffect) ) import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new )-import Data.Maybe () import Universe ( Arena(lance) ) import qualified Universe as U ( Arena(wrapMap) )-import Sound.ALUT ( Source )-import Common ( Velocity, Time, Angle )-+import Common radialVelocity = pi maxVelocityMag = 400
Unit/Smart/Master.hs view
@@ -1,50 +1,35 @@+{-|+Module : Unit.Smart.Master+Description : A Ninja with a cloaking ability+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.Master ( Master(..) , new ) where +import Prelude ((>), Maybe(..), max, (-), (.), (+), (>=), (/), abs, (*), (==), Bool(..), return, (<), otherwise, (<=), pi, Double, not, ($)) import Data.WrapAround ( WP, WM, vectorRelation )-import Animation- ( Audible(..),- Animation(..),- audioReferenceDistance,- audioRolloffFactor )-import Graphics.Gloss.Data.Picture- ( Picture(Blank, Color, Rotate, Scale, Text) )+import Graphics.Gloss.Data.Picture ( Picture(Color, Rotate, Scale, Text, Blank) ) import Graphics.Gloss.Data.Color ( white ) import GHC.Float ( double2Float )-import Math ( radToDeg, vectorDirection, targetingA, subV )-import ResourceTracker ( ResourceTracker, getImage, getSound )+import Data.Maybe ( isNothing, fromMaybe, fromJust )+import Sound.ALUT ( Vertex3(Vertex3), HasSetter(($=)), SourceRelative(Listener), Source, ObjectName(genObjectNames), stop, sourceRelative, sourcePosition, rolloffFactor, referenceDistance, play, buffer )++import Animation+import Math+import ResourceTracker import Updating- ( Observant(..), Transient(..), InternallyUpdating(..) )-import qualified Moving as M- ( Colliding(..),- Moving(..),- Locatable(..),- newVelocity,- newLocation )+import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newVelocity, newLocation ) import Combat- ( Launcher(..), Damageable(..), Damaging(..), Projectile(..) ) import qualified Projectile.Blade as P.Blade ( speed, new )-import AfterEffect ( AfterEffect(AfterEffect) )-import qualified AfterEffect.SimpleExplosion as SimpleExplosion- ( new )-import Data.Maybe ( isNothing, fromMaybe, fromJust )+import AfterEffect+import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new ) import Universe ( Arena(lance) ) import qualified Universe as U ( Arena(wrapMap) )-import Sound.ALUT- ( Vertex3(Vertex3),- HasSetter(($=)),- SourceRelative(Listener),- Source,- ObjectName(genObjectNames),- stop,- sourceRelative,- sourcePosition,- rolloffFactor,- referenceDistance,- play,- buffer )-import Common ( Velocity, Angle, Time )+import Common radialVelocity = pi/2 -- radians per second
Unit/Smart/Ninja.hs view
@@ -1,50 +1,35 @@+{-|+Module : Unit.Smart.Ninja+Description : Fast space ship shooting spinning blades+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.Ninja ( Ninja(..) , new ) where +import Prelude ((>), Maybe(..), max, (-), (.), (+), (>=), (/), abs, (*), (==), Bool(..), return, (<), otherwise, (<=), pi, Double, not, ($)) import Data.WrapAround ( WP, WM, vectorRelation )-import Animation- ( Audible(..),- Animation(..),- audioReferenceDistance,- audioRolloffFactor )-import Graphics.Gloss.Data.Picture- ( Picture(Color, Rotate, Scale, Text) )+import Graphics.Gloss.Data.Picture ( Picture(Color, Rotate, Scale, Text) ) import Graphics.Gloss.Data.Color ( white ) import GHC.Float ( double2Float )-import Math ( radToDeg, vectorDirection, targetingA, subV )-import ResourceTracker ( ResourceTracker, getImage, getSound )+import Data.Maybe ( isNothing, fromMaybe, fromJust )+import Sound.ALUT ( Vertex3(Vertex3), HasSetter(($=)), SourceRelative(Listener), Source, ObjectName(genObjectNames), stop, sourceRelative, sourcePosition, rolloffFactor, referenceDistance, play, buffer )++import Animation+import Math+import ResourceTracker import Updating- ( Observant(..), Transient(..), InternallyUpdating(..) )-import qualified Moving as M- ( Colliding(..),- Moving(..),- Locatable(..),- newVelocity,- newLocation )+import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newVelocity, newLocation ) import Combat- ( Launcher(..), Damageable(..), Damaging(..), Projectile(..) ) import qualified Projectile.Blade as P.Blade ( speed, new )-import AfterEffect ( AfterEffect(AfterEffect) )-import qualified AfterEffect.SimpleExplosion as SimpleExplosion- ( new )-import Data.Maybe ( isNothing, fromMaybe, fromJust )+import AfterEffect+import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new ) import Universe ( Arena(lance) ) import qualified Universe as U ( Arena(wrapMap) )-import Sound.ALUT- ( Vertex3(Vertex3),- HasSetter(($=)),- SourceRelative(Listener),- Source,- ObjectName(genObjectNames),- stop,- sourceRelative,- sourcePosition,- rolloffFactor,- referenceDistance,- play,- buffer )-import Common ( Velocity, Angle, Time )+import Common radialVelocity = pi/2 -- radians per second
Unit/Smart/STank.hs view
@@ -1,36 +1,33 @@+{-|+Module : Unit.Smart.STank+Description : Super tank+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.STank ( STank(..) , new ) where +import Prelude ((.), Maybe(..), max, (-), pi, Bool(..), (/), Double, map, (+)) import Data.WrapAround ( WP, WM )+import Sound.ALUT ( Source )+ import Animation- ( Audible(..), Animation(..), termSndSrc, reorient, handSndSrc )-import Graphics.Gloss.Data.Picture ()-import Graphics.Gloss.Data.Color ()-import GHC.Float ()-import Math ( moreThanZero )-import ResourceTracker ( ResourceTracker, protectedGetImage )+import Math+import ResourceTracker import Updating- ( Transient(..), Observant(..), InternallyUpdating(..) )-import qualified Moving as M- ( Moving(..),- Locatable(..),- Colliding(..),- newVelocity,- newLocation )+import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newVelocity, newLocation ) import Combat- ( Projectile, Launcher(..), Damaging(..), Damageable(..) ) import qualified Projectile.BulletMII as P.BulletMII ( prj ) import AfterEffect ( AfterEffect(AfterEffect) )-import qualified AfterEffect.SimpleExplosion as SimpleExplosion- ( new )-import Data.Maybe ()+import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new ) import Universe ( Arena ) import qualified Universe as U ()-import Sound.ALUT ( Source )-import Common ( Velocity, Time, Angle )-import UnitUtil ( adjAngle, firingAngle )-import Unit ( firing )+import Common+import UnitUtil+import Unit radialVelocity = pi/4 maxVelocityMag = 100
Unit/Smart/Saucer.hs view
@@ -1,49 +1,35 @@+{-|+Module : Unit.Smart.Saucer+Description : Flying saucer+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.Saucer ( Saucer(..) , new ) where +import Prelude (Maybe(..), (>), max, (-), Bool(..), length, (+), (!!), (>=), (&&), (.), (<=), (/), abs, otherwise, (==), return, (*), (<), pi, Double, Int, not, ($)) import Data.WrapAround ( WP, WM, vectorRelation, distance )-import Animation- ( Audible(..),- Animation(..),- audioReferenceDistance,- audioRolloffFactor ) import Graphics.Gloss.Data.Picture ( Picture(Color, Scale, Text) ) import Graphics.Gloss.Data.Color ( white ) import GHC.Float ( double2Float )-import Math ( vectorDirection )-import ResourceTracker ( ResourceTracker, getImage, getSound )+import Data.Maybe ( isNothing, fromMaybe, fromJust )+import Sound.ALUT ( Vertex3(Vertex3), HasSetter(($=)), SourceRelative(Listener), Source, ObjectName(genObjectNames), stop, sourceRelative, sourcePosition, rolloffFactor, referenceDistance, play, buffer )++import Animation+import Math+import ResourceTracker import Updating- ( Observant(..), Transient(..), InternallyUpdating(..) )-import qualified Moving as M- ( Colliding(..),- Moving(..),- Locatable(..),- newVelocity,- newLocation )+import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..), newVelocity, newLocation ) import Combat- ( Launcher(..), Damageable(..), Damaging(..), Projectile(..) ) import qualified Projectile.Pellet as P.Pellet ( range, new ) import AfterEffect ( AfterEffect(AfterEffect) )-import qualified AfterEffect.SimpleExplosion as SimpleExplosion- ( new )-import Data.Maybe ( isNothing, fromMaybe, fromJust )+import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new ) import Universe ( Arena(lance) ) import qualified Universe as U ()-import Sound.ALUT- ( Vertex3(Vertex3),- HasSetter(($=)),- SourceRelative(Listener),- Source,- ObjectName(genObjectNames),- stop,- sourceRelative,- sourcePosition,- rolloffFactor,- referenceDistance,- play,- buffer )-import Common ( Velocity, Angle, Time )+import Common radialVelocity = pi -- radians per second
Unit/Smart/Tank.hs view
@@ -1,36 +1,33 @@+{-|+Module : Unit.Smart.Tank+Description : Basic tank+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.Tank ( Tank(..) , new ) where +import Prelude ((.), Maybe(..), max, (-), pi, Bool(..), (/), Double) import Data.WrapAround ( WP, WM )+import Sound.ALUT ( Source )+ import Animation- ( Audible(..), Animation(..), termSndSrc, reorient, handSndSrc )-import Graphics.Gloss.Data.Picture ()-import Graphics.Gloss.Data.Color ()-import GHC.Float ()-import Math ( moreThanZero )-import ResourceTracker ( ResourceTracker, protectedGetImage )+import Math+import ResourceTracker import Updating- ( Transient(..), Observant(..), InternallyUpdating(..) )-import qualified Moving as M- ( Moving(..),- Locatable(..),- Colliding(..),- newVelocity,- newLocation )+import qualified Moving as M ( Moving(..), Locatable(..), Colliding(..), newVelocity, newLocation ) import Combat- ( Projectile, Launcher(..), Damaging(..), Damageable(..) ) import qualified Projectile.BulletSI as P.BulletSI ( prj ) import AfterEffect ( AfterEffect(AfterEffect) )-import qualified AfterEffect.SimpleExplosion as SimpleExplosion- ( new )-import Data.Maybe ()+import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new ) import Universe ( Arena ) import qualified Universe as U ()-import Sound.ALUT ( Source )-import Common ( Velocity, Time, Angle )-import UnitUtil ( adjAngle, firingAngle )-import Unit ( firing )+import Common+import UnitUtil+import Unit radialVelocity = pi/6 maxVelocityMag = 40
Unit/Smart/Zeus.hs view
@@ -1,47 +1,35 @@+{-|+Module : Unit.Smart.Zeus+Description : Stationary heavy cannon with targeting+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Unit.Smart.Zeus ( Zeus(..) , new ) where +import Prelude (Bool(..), (>), max, (-), (+), (++), (.), (>=), Maybe(..), ($), return, (*), pi, not, Double) import Data.WrapAround ( WP, WM, vectorRelation )-import Animation- ( Audible(..),- Animation(..),- audioReferenceDistance,- audioRolloffFactor )-import Graphics.Gloss.Data.Picture- ( Picture(Color, Pictures, Rotate, Scale, Text) )+import Graphics.Gloss.Data.Picture ( Picture(Color, Pictures, Rotate, Scale, Text) ) import Graphics.Gloss.Data.Color ( white ) import GHC.Float ( double2Float )-import Math ( radToDeg, targetingA, subV )-import ResourceTracker ( ResourceTracker, getImage, getSound )+import Data.Maybe ( isNothing, fromMaybe, fromJust )+import Sound.ALUT ( Vertex3(Vertex3), HasSetter(($=)), SourceRelative(Listener), Source, ObjectName(genObjectNames), stop, sourceRelative, sourcePosition, rolloffFactor, referenceDistance, play, buffer )++import Animation+import Math+import ResourceTracker import Updating- ( Observant(..), Transient(..), InternallyUpdating(..) )-import qualified Moving as M- ( Colliding(..), Moving(..), Locatable(..) )+import qualified Moving as M ( Colliding(..), Moving(..), Locatable(..) ) import Combat- ( Launcher(..), Damageable(..), Damaging(..), Projectile(..) )-import qualified Projectile.Interceptor as P.Interceptor- ( speed, new )+import qualified Projectile.Interceptor as P.Interceptor ( speed, new ) import AfterEffect ( AfterEffect(AfterEffect) )-import qualified AfterEffect.SimpleExplosion as SimpleExplosion- ( new )-import Data.Maybe ( isNothing, fromMaybe, fromJust )+import qualified AfterEffect.SimpleExplosion as SimpleExplosion ( new ) import Universe ( Arena(lance) ) import qualified Universe as U ( Arena(wrapMap) )-import Sound.ALUT- ( Vertex3(Vertex3),- HasSetter(($=)),- SourceRelative(Listener),- Source,- ObjectName(genObjectNames),- stop,- sourceRelative,- sourcePosition,- rolloffFactor,- referenceDistance,- play,- buffer )-import Common ( Angle, Time )+import Common radialVelocity = pi -- radians per second
UnitUtil.hs view
@@ -1,12 +1,13 @@ module UnitUtil where -import Lance ()-import Math ( vectorDirection )+import Prelude ((+), Maybe(..), (>), (*), (-), (<), Double, otherwise) import Data.WrapAround ( vectorRelation )-import Moving ( Moving(..), Locatable(..) ) import Data.Maybe ( isNothing, fromJust )-import Common ( Angle, Time )-import Universe ( Arena(lance, wrapMap) )++import Math+import Moving+import Common+import Universe adjAngle :: (Moving a) => a -- ^ the object whose angle is adjusted
Universe.hs view
@@ -1,17 +1,27 @@+{-|+Module : Universe+Description : Defines the game state+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Universe where -import Lance ( Lance )-import Star ()+import Prelude (Double, Bool(..), Maybe(..), Integer, Int) import Data.WrapAround ( WP, WM, wrappoint, wrapmap )-import SpaceJunk ( SpaceJunk )-import Combat ( Projectile )-import AfterEffect ( AfterEffect )-import Unit ( SimpleUnit, SmartUnit )-import ResourceTracker ( ResourceTracker )-import Item ( Item )-import Common ( Time ) import Sound.ALUT ( Source )-import AWS ( AWS )++import Lance+import Star+import SpaceJunk+import Combat+import AfterEffect+import Unit+import ResourceTracker+import Item+import Common+import AWS data Arena = Arena { lance :: Maybe Lance , focus :: WP
Updating.hs view
@@ -1,8 +1,18 @@+{-|+Module : Updating+Description : Interfaces for objects which update over time+Copyright : (c) Christopher Howard, 2016+License : GPL-3+Maintainer : ch.howard@zoho.com+-}+ module Updating where +import Prelude (Maybe(..), Bool(..))+ import {-# SOURCE #-} AfterEffect ( AfterEffect ) import {-# SOURCE #-} Universe ( Arena )-import Common (Time)+import Common class InternallyUpdating a where preUpdate :: a -> Time -> a
edge.cabal view
@@ -8,7 +8,7 @@ -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented. -Version: 0.9.0.2+Version: 0.9.1.0 -- A short (one-line) description of the package. Synopsis: Top view space combat arcade game@@ -24,7 +24,7 @@ Good luck commander! -- URL for the project homepage or repository.-Homepage: http://frigidcode.com/code/edge+Homepage: https://qlfiles.net -- The license under which the package is released. License: GPL-3@@ -37,7 +37,7 @@ -- An email address to which users can send suggestions, bug reports, -- and patches.-Maintainer: christopher.howard@frigidcode.com+Maintainer: ch.howard@zoho.com -- A copyright notice. -- Copyright: @@ -48,7 +48,7 @@ -- Extra files to be distributed with the package, such as examples or -- a README.-Extra-source-files: DONATE, edge.svg, AUTHORS+Extra-source-files: edge.svg, AUTHORS -- Constraint on the version of Cabal needed to build this package. Cabal-version: >=1.10@@ -58,14 +58,25 @@ Executable edge -- .hs or .lhs file containing the Main module.- Main-is: edge.hs+ Main-is: Main.hs Default-language: Haskell2010 -- Packages needed in order to build this package.- Build-depends: gloss >= 1.7.4.1 && < 1.8++ -- Gloss 1.9 changes the makeColor8 function to makeColorI, and+ -- removes the function loadBMP entirely, breaking our code++ -- edge very much needs to be recoded for a version of OpenAL >=+ -- 1.5.0.0 and ALUT >= 2.3.0.0, as the I cannot even build the+ -- required versions myself. Fortunately they are available+ -- pre-built in Debian Jessie. ALUT-2.2.0.0 has the failing that it+ -- exports OpenAL but does not specify an OpenAL version. OpenAL+ -- seems to change the fundamental types of the library.+ Build-depends: gloss >= 1.7.4.1 && < 1.9 , wraparound >= 0.0.2 && < 0.1 , base >= 4 && < 5 , containers >= 0.4.2.1 && < 0.6+ , OpenAL == 1.4.0.2 , ALUT >= 2.2 && < 2.3 , random >= 1.0.1.1 && < 1.1 , cmdtheline >= 0.2.1.1 && < 0.3
− edge.hs
@@ -1,133 +0,0 @@-import Data.Function ( ($) )-import Control.Monad ( return )-import Text.Show ( Show )-import Data.Bool ( Bool ( True, False ), not )-import Data.Maybe ( Maybe ( Just, Nothing ) )-import Data.List ( null, head )-import System.IO.Error ( userError, ioError )-import Data.WrapAround ( wrappoint )-import Graphics.Gloss.Interface.IO.Game- ( black, Display(InWindow), playIO )-import Lance ( new )-import Resources ( initResources, initLevels )-import Input ( handleInput )-import Universe- ( Arena(lance, wrapMap),- Universe(Universe, arena, aws, blipSoundSource, delayRemaining,- level, levelMessageTimer, lives, panelActivationTimer,- queueBlipSound, resourceTracker, skipLevel, startGameTimer,- levels) )-import Display ( AWS(..), displayUniverse )-import AWS ()-import Step ( stepUniverse )-import Unit ()-import Unit.Simple.Turret ()-import qualified Unit.Simple.Turret as Turret ()-import ResourceTracker ( getSound )-import Sound.ALUT- ( HasSetter(($=)),- HasGetter(get),- LoopingMode(Looping),- ALError(ALError),- ObjectName(genObjectNames),- sourceGain,- play,- loopingMode,- buffer,- alErrors,- distanceModel,- withProgNameAndArgs,- runALUT )-import Data.Maybe ()-import System.IO ( stderr, hPutStrLn )-import Data.List ( intersperse, concat )-import Animation ( audioDistanceModel )-import System.Console.CmdTheLine- ( TermInfo(termName, version),- OptInfo(optDoc),- eval,- defTI,- value,- optInfo,- opt )-import Control.Applicative ( (<$>) )-import qualified Paths_edge as P ( version )-import Data.Version ( showVersion )--displayMode a = InWindow "The Edge" a (0, 0)--sizePassed = value (opt "default"- ((optInfo [ "size", "s" ])- { optDoc = "assumed screen size, used\- \ in layout of game visuals" }- ))--data EdgeOpts = EdgeOpts { size :: Maybe AWS }- deriving Show--switchboard a = EdgeOpts { size = case a of- "default" -> Just W1024- "1024x768" -> Just W1024- "1280x1024" -> Just W1280- otherwise -> Nothing- } --term = switchboard <$> sizePassed--termInfo = defTI { termName = "edge", version = showVersion P.version }--main = withProgNameAndArgs runALUT $ \progName args ->- do a <- eval args (term, termInfo)- case size a of- Nothing -> ioError (userError- "Only 1024x768 and 1280x1024 are acceptable\- \ size arguments at this time.")- Just b -> edge b--edge a = do universe <- initUniverse a- distanceModel $= audioDistanceModel- -- listenerPosition $= (Vertex3 0 0 0)- errs <- get alErrors- if not (null errs)- then hPutStrLn- stderr- (concat- (intersperse "," [ d | ALError _ d <- errs ]))- else return ()- playMusic (resourceTracker universe)- playIO- (displayMode (case a of W1024 -> (1024, 768); W1280 -> (1280, 1024)))- black 20 universe displayUniverse handleInput stepUniverse--initUniverse b =- do rt <- initResources- rLevels <- initLevels rt- let sArena = head rLevels- let wmap = Universe.wrapMap sArena- return Universe { arena = sArena-- { lance = Just (Lance.new rt wmap- (wrappoint wmap (0, 0)))- }-- , level = 0- , Universe.levels = rLevels- , lives = 3- , delayRemaining = 2.0- , resourceTracker = rt- , skipLevel = False- , levelMessageTimer = Nothing- , panelActivationTimer = 0.0- , startGameTimer = 0.0- , queueBlipSound = True- , blipSoundSource = Nothing- , aws = b- }--playMusic rt =- do [source] <- genObjectNames 1- buffer source $= getSound rt "music.wav"- sourceGain source $= 0.4- loopingMode source $= Looping- play [source]-