home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IO Examples / Worm / wormstate.dcl < prev    next >
Encoding:
Modula Definition  |  1997-05-01  |  1.7 KB  |  59 lines  |  [TEXT/3PRM]

  1. definition module wormstate
  2.  
  3. import    StdInt
  4. from    deltaTimer        import TicksPerSecond
  5. from    deltaPicture    import Point, Rectangle
  6. import    Highscore, Random
  7.  
  8. ::    *State
  9.     =    {    level        :: Level            // The current level of the game
  10.         ,    food        :: Food                // The current piece of food
  11.         ,    foodsupply    :: [Food]            // The food supply (infinite list of random food)
  12.         ,    grow        :: Grow                // The amount of growth of the worm
  13.         ,    points        :: Points            // The current score of the player
  14.         ,    dir            :: Direction        // The current direction of the worm
  15.         ,    worm        :: Worm                // The worm itself
  16.         ,    best        :: HiScores            // The HighScore information
  17.         ,    lives        :: Lives            // The current nr of remaining lives
  18.         }
  19. ::    Level
  20.     =    {    fix            :: Int                // The initial speed (TimerInterval) of the game
  21.         ,    speed        :: Int                // The current speed (TimerInterval) of the game ([fix,fix-0.05sec..0])
  22.         ,    level        :: Int                // The current level ([0..])
  23.         ,    obstacles    :: [Obstacle]        // The obstacles of this level
  24.         }
  25. ::    Food
  26.     =    {    value        :: Int                // The growing power of this food
  27.         ,    pos            :: Point            // The location of this food
  28.         }
  29. ::    Grow                :== Int
  30. ::    Direction            :== Char
  31. ::    Obstacle            :== Rectangle
  32. ::    Segment                :== Point
  33. ::    Worm                :== [Segment]
  34. ::    Points                :== Int
  35. ::    Lives                :== Int
  36.  
  37. SizeX            :== 45
  38. SizeY            :== 26
  39.  
  40. NrOfWorms        :== 4
  41. NrOfLevels        :== 8
  42. PointsPerLevel    :== 500
  43. StartLevel        :== 0
  44.  
  45. EasySpeed        :== TicksPerSecond/6
  46. MediumSpeed        :== TicksPerSecond/9
  47. HardSpeed        :== TicksPerSecond/18
  48. Accelation        :==    TicksPerSecond/18
  49.  
  50. InitState        :: HiScores                -> State
  51.  
  52. NewWorm            :: Level                -> Worm
  53. InitLevel        :: Int                    -> Level
  54. DecreaseLevel    :: Level                -> Level
  55. IncreaseLevel    :: Level                -> Level
  56.  
  57. FoodSupply        :: RandomSeed            -> [Food]
  58. NewFood            :: Worm Level [Food]    -> (Food, [Food])
  59.