; Welcome to the GameKit game editor!
;
; You can create your own game using this program.
; For detailed instructions, check out your manual.
; It is in Microsoft Word, RTF, and Raw text format
; in your GameKit directory.
;
PROGRAM{

  CLASSES{
    player{
      normal{
        If keyboard.left = "true" {
          MoveLeft Me 6
        }if
        If keyboard.right = "true" {
          if me.yellow = "true"{  ;;; make morgan let this be false!!!
          }else{
            MoveRight Me 6
          }if
        }if
        If keyboard.down = "true" {
          MoveDown Me 6
        }if
        If me.blue = "true" {  ; if standing on something
          if keyboard.space = "true" {
            setspeed me 4.2
          }if
        }else{
          if me.speed > -2 {   ; fall unless terminal velocity
            changespeed me -.3
          }if
        }if; gravity constant
        Move Me
      }normal
      collision{
        If It.class = monster {
          Destroy me
        }if
        If It.class = treasure {
          change counter$points +10
        }if
        If It.class = key {
          change counter$key +1
        }if
        If It.class = lock {
          If counter$key = 1 {
            change counter$level +1
            SetState DrawLevel
          }if
        }if
      }collision
      Mapchange{
        If me.yellow = "true" {
          Unmove Me
          setspeed me 0
        }if
      }mapchange
      Destroy{
        SetState GameOver
      }destroy
    }player
    
    
    
    Monster1{
      Normal{
        Moveforward Me 3
      }normal
      Mapchange{
        If me.yellow = "true"{
          changedirection me 180
        }if
      }mapchange
      Collision{
        If It.class = player {
          Destroy It
        }If
      }Collision
    }monster1
    monster2{
      Normal{
        Moveforward Me 5
      }normal
      Mapchange{
        If me.yellow = "true"{
          changedirection me 180
        }if
      }mapchange
      Collision{
        If It.class = player {
          Destroy It
        }If
      }collision
    }monster2
    monster3{
      Normal{
        Moveforward Me 6
      }normal
      Mapchange{
        If me.yellow = "true" {
          changedirection me 30
        }if
      }mapchange
      Collision{
        If It.class = player {
          Destroy It
        }If
      }Collision
    }monster3
    key{
    }key
    treasure{
    }treasure
    lock{
    }lock
  }CLASSES
  STATES{
    BEGIN{
      Initialize{
        SetState TITLE
      }initialize
    }BEGIN
    TITLE{
      Initialize{
        Setbackground game "title.jpg"
        set counter$points 0
        set counter$level 1
      }initialize
      loop{
        If keyboard.x = "true" {
          setstate END
        }else {
          if keyboard.anykey = "true" {
            SetState DrawLevel
          }if
        }if
      }loop
    }Title
    DRAWLEVEL{
      Initialize{
        destroyall
        Set Counter$key 0
        If counter$level = 1 {
          setbackground game "grass.jpg"
          setmap game "grass.map"
          create player 1 "sprite" 90 0 -90 90 80
          ;          create monster1 1 "mon2.jpeg" 0 0 50 -50 10
          ;          create monster1 2 "mon2.jpeg" 0 0 -90 -50 10
          ;          create monster1 3 "mon2.jpeg" 0 0 70 80 10
          ;          create monster2 1 "mon5.jpeg" 0 0 -90 -90 10
          ;          create monster2 2 "mon5.jpeg" 0 0 0 -88 10
          ;          create monster3 1 "m6.jpeg" 0 0 0 50 25
          ;          create monster3 2 "m6.jpeg" 0 0  0 -50 25
          ;          create key 1 "key.jpeg" 0 0 90 0 10
          ;          create lock 1 "lock.jpeg" 0 0 -90 -90 20
          ;          create treasure 1 "mon1.jpeg" 0 0 0 -85 20
          ;          create treasure 1 "mon1.jpeg" 0 0 95 85 20
          ;          create treasure 1 "mon1.jpeg" 0 0 -90 0 20
        }if
        If counter$level = 2 {
          setbackground game "gback2.jpg"
          create player 1 "sprite.jpg" 0 0 -90 -75 80
          create monster1 1 "m8.jpeg" 0 0 -25 -70 10
          create monster1 2 "m8.jpeg" 0 0 -90 -50 10
          create monster1 3 "m8.jpeg" 0 0 50 90 10
          create monster2 1 "m7.jpeg" 0 0 -50 -40 10
          create monster2 2 "m7.jpeg" 0 0 0 -99 10
          create monster3 1 "mon3.jpeg" 0 0 0 50 25
          create monster3 2 "mon3.jpeg" 0 0 0 -50 25
          create key 1 "key.jpeg" 0 0 -80 80 10
          create lock 1 "lock.jpeg" 0 0 90 -60 20
          create treasure 1 "m1.jpeg" 0 0 90 50 20
          create treasure 1 "m1.jpeg" 0 0 -90 0 20
        }if
        If counter$level = 3 {
          setState Win
        }if
      }initialize
    }drawlevel
    PLAY{
      loop{
      }loop
    }play
    WIN{
      initialize{
        setbackground game "win.jpg"
      }initialize
      loop{
        if keyboard.anykey = "true" {
          setState END
        }if
      }loop
    }win
    GAMEOVER{
      initialize{
        setbackground game "lose.jpeg"
      }initialize
      loop{
        if keyboard.anykey = "true" {
          setState END
        }if
      }loop
    }gameover
  }STATES
}PROGRAM
















