none
I NEED HELP !!!!!!!!!!!!!! 2 RRS feed

  • Question

  • ' Daniel and the Lions 
    ' Small Basic Version 

    ' Intro screen 
    IntroScreen: 
    Difficulty = 1 
    GameStatus = "Initial" 
    GraphicsWindow.Show() 
    GraphicsWindow.Title = "Daniel and the Lions" 
    GraphicsWindow.BackgroundColor = "White" 
    GraphicsWindow.Width = 1000 
    GraphicsWindow.Height = 700 
    GraphicsWindow.BrushColor = "Black" 
    GraphicsWindow.FontSize = 14 
    GraphicsWindow.DrawText(110, 10, "DANIEL AND THE LIONS") 
    GraphicsWindow.DrawText(110, 30, "In Daniel 6:16‐28, King Darius is tricked into putting Daniel into the Lions Den. Daniel prays for God’s protection") 
    GraphicsWindow.DrawText(110, 50, "and God sends His Angel to shut the Lion’s mouth.  God will protect you if you pray to Him today.")  
    GraphicsWindow.DrawText(110, 180, "<‐‐ Select Difficulty by pressing the left button for Easy and the right button for Harder.")  
    GraphicsWindow.DrawText(110, 230, "<‐‐ Click on the Start Button to begin.")
    GraphicsWindow.DrawText(110, 270, "<‐‐ Click on the Stop Button to stop the program.") 
    GraphicsWindow.DrawText(110, 360, "<‐‐ Use these buttons (or keypad keys) to move Daniel.") 
    GraphicsWindow.DrawText(110, 490, "<‐‐ Use these buttons to 'shoot' prayers at lions.") 
    GraphicsWindow.BrushColor = "Blue" 
    GraphicsWindow.FillRectangle(0, 0, 100, GraphicsWindow.Height)
    GraphicsWindow.BrushColor = "Yellow" 
    GraphicsWindow.FontSize = 18 
    GraphicsWindow.DrawText(15, 20, "Moves:") 
    GraphicsWindow.DrawText(20, 70, "Lions:") 
    GraphicsWindow.DrawText(5, 120, "Difficulty:") 
    GraphicsWindow.DrawText(25, 300, "Move") 
    GraphicsWindow.DrawText(20, 430, "Shoot") 
    GraphicsWindow.FontSize = 12 
    GraphicsWindow.DrawText(10, 410, "Click Middle") 
    GraphicsWindow.DrawText(10, 420, "For No Move") 
    GraphicsWindow.BrushColor = "White" 
    GraphicsWindow.FontSize = 18 
    GraphicsWindow.DrawText(35, 140, Difficulty) 
    GraphicsWindow.BrushColor = "LightGray" 
    GraphicsWindow.FillRectangle(15, 170, 30, 30)
    GraphicsWindow.FillRectangle(55, 170, 30, 30) 
    GraphicsWindow.FillRectangle(5, 220, 90, 30) 
    GraphicsWindow.FillRectangle(5, 260, 90, 30) 
    GraphicsWindow.BrushColor = "Black" 
    GraphicsWindow.FontSize = 14 
    GraphicsWindow.DrawText(25, 175, "<") 
    GraphicsWindow.DrawText(65, 175, ">") 
    GraphicsWindow.DrawText(30, 225, "Start") 
    GraphicsWindow.DrawText(30, 265, "Stop") 
    MoveImage = ImageList.LoadImage(Program.Directory + 5"\MoveButtons.jpg") 
    MoveButtons = Shapes.AddImage(MoveImage) 
    Shapes.Move(MoveButtons, 5, 320) 
    ShootImage  = ImageList.LoadImage(Program.Directory + "\ShootButtons.jpg") 
    ShootButtons = Shapes.AddImage(ShootImage) 
    Shapes.Move(ShootButtons, 5, 450)

    Can you tell me why it will not work ?

     
    Thursday, June 19, 2014 8:01 PM

Answers

  • Welcome GameMaker91,

    Apart from the typo below it does work (do exactly what the code tells it to do).

    MoveImage = ImageList.LoadImage(Program.Directory + 5"\MoveButtons.jpg")

    Thursday, June 19, 2014 9:00 PM
    Moderator

All replies

  • Welcome GameMaker91,

    Apart from the typo below it does work (do exactly what the code tells it to do).

    MoveImage = ImageList.LoadImage(Program.Directory + 5"\MoveButtons.jpg")

    Thursday, June 19, 2014 9:00 PM
    Moderator
  • Thank you for that answer i tied it and then another problem came and another

    i changed the code, fixed the problems and a blank screen appeared here is the complete unchanged code,

     

    ' Daniel and the Lions 
    ' Small Basic Version 

    ' Intro screen 
    IntroScreen: 
    Difficulty = 1 
    GameStatus = "Initial" 
    GraphicsWindow.Show() 
    GraphicsWindow.Title = "Daniel and the Lions" 
    GraphicsWindow.BackgroundColor = "White" 
    GraphicsWindow.Width = 1000 
    GraphicsWindow.Height = 700 
    GraphicsWindow.BrushColor = "Black" 
    GraphicsWindow.FontSize = 14 
    GraphicsWindow.DrawText(110, 10, "DANIEL AND THE LIONS") 
    GraphicsWindow.DrawText(110, 30, "In Daniel 6:16‐28, King Darius 
    is tricked into putting Daniel into the Lions Den. Daniel prays 
    for God’s protection") 
    GraphicsWindow.DrawText(110, 50, "and God sends His Angel to shut 
    the Lion’s mouth.  God will protect you if you pray to Him 
    today.")  
    GraphicsWindow.DrawText(110, 180, "<‐‐ Select Difficulty by 
    pressing the left button for Easy and the right button for 
    Harder.")  
    GraphicsWindow.DrawText(110, 230, "<‐‐ Click on the Start Button 
    to begin.") 
    GraphicsWindow.DrawText(110, 270, "<‐‐ Click on the Stop Button to 
    stop the program.") 
    GraphicsWindow.DrawText(110, 360, "<‐‐ Use these buttons (or 
    keypad keys) to move Daniel.") 
    GraphicsWindow.DrawText(110, 490, "<‐‐ Use these buttons to 
    'shoot' prayers at lions.") 
    GraphicsWindow.BrushColor = "Blue" 
    GraphicsWindow.FillRectangle(0, 0, 100, GraphicsWindow.Height) 
    GraphicsWindow.BrushColor = "Yellow" 
    GraphicsWindow.FontSize = 18 
    GraphicsWindow.DrawText(15, 20, "Moves:")

     

    GraphicsWindow.DrawText(20, 70, "Lions:") 
    GraphicsWindow.DrawText(5, 120, "Difficulty:") 
    GraphicsWindow.DrawText(25, 300, "Move") 
    GraphicsWindow.DrawText(20, 430, "Shoot") 
    GraphicsWindow.FontSize = 12 
    GraphicsWindow.DrawText(10, 410, "Click Middle") 
    GraphicsWindow.DrawText(10, 420, "For No Move") 
    GraphicsWindow.BrushColor = "White" 
    GraphicsWindow.FontSize = 18 
    GraphicsWindow.DrawText(35, 140, Difficulty) 
    GraphicsWindow.BrushColor = "LightGray" 
    GraphicsWindow.FillRectangle(15, 170, 30, 30) 
    GraphicsWindow.FillRectangle(55, 170, 30, 30) 
    GraphicsWindow.FillRectangle(5, 220, 90, 30) 
    GraphicsWindow.FillRectangle(5, 260, 90, 30) 
    GraphicsWindow.BrushColor = "Black" 
    GraphicsWindow.FontSize = 14 
    GraphicsWindow.DrawText(25, 175, "<") 
    GraphicsWindow.DrawText(65, 175, ">") 
    GraphicsWindow.DrawText(30, 225, "Start") 
    GraphicsWindow.DrawText(30, 265, "Stop") 
    MoveImage = ImageList.LoadImage(Program.Directory + 
    "\MoveButtons.jpg") 
    MoveButtons = Shapes.AddImage(MoveImage) 
    Shapes.Move(MoveButtons, 5, 320) 
    ShootImage  = ImageList.LoadImage(Program.Directory + 
    "\ShootButtons.jpg") 
    ShootButtons = Shapes.AddImage(ShootImage) 
    Shapes.Move(ShootButtons, 5, 450) 
    GraphicsWindow.MouseDown = MouseDownEvent 
    GraphicsWindow.KeyDown = KeyDownEvent 

    Sub MouseDownEvent 
      X = GraphicsWindow.MouseX 
      Y = GraphicsWindow.MouseY 
      If (GameStatus = "Initial") Then 
        If (Y > 175 And Y < 205) Then 
          If (X > 15 And X < 45) Then 
            ' decrease difficulty 
            Difficulty = Difficulty ‐ 1 
            If (Difficulty < 1) Then 
              Difficulty = 1 
            EndIf 
          ElseIf (X > 55 And X < 85) Then 
            'increase difficulty 
            Difficulty = Difficulty + 1 

    If (Difficulty > 10) Then 
              Difficulty = 10 
            EndIf 
          EndIf 
          GraphicsWindow.BrushColor = "Blue" 
          GraphicsWindow.FillRectangle(0, 140, 100, 20) 
          GraphicsWindow.BrushColor = "White" 
          GraphicsWindow.FontSize = 18 
          GraphicsWindow.DrawText(35, 140, Difficulty) 
        ElseIf (Y > 220 And Y < 250) Then 
          If (X > 5 And X < 95) Then 
            'clicked start 
            GameStatus = "DanielMove" 
            GameOver = "false" 
            GraphicsWindow.BrushColor = "White" 
            GraphicsWindow.FillRectangle(100, 0, GraphicsWindow.Width 
    ‐ 100, GraphicsWindow.Height) 
            Moves = 0 
            NumberLions = Difficulty + 5 
            LionsLeft = NumberLions 
            DisplayMovesLions() 
            '  draw grid structure 
            GraphicsWindow.BrushColor = "Black" 
            GraphicsWindow.FillRectangle(145, 45, 810, 510) 
            GraphicsWindow.BrushColor = "White" 
            GraphicsWindow.FillRectangle(150, 50, 800, 500) 
            GraphicsWindow.PenWidth = 1 
            GraphicsWindow.PenColor = "Gray" 
            For i = 1 to 9 
              GraphicsWindow.DrawLine(150, (i + 1) * 50, 950, (i + 1) 
    * 50) 
            EndFor 
            For i = 1 to 19 
              GraphicsWindow.DrawLine(150 + i * 40, 50, 150 + i * 40, 
    550) 
            EndFor 
            For i = 1 to 10 
              For j = 1 to 20 
                A[i][j] = 0 
              EndFor 
            EndFor 
            '  Place rocks 
            ' A array (0‐ nothing, 1‐rock, 2‐lion, 3‐Daniel) 
            A[4][5] = 1 
            A[4][16] = 1 
            A[7][5] = 1 

    A[7][16] = 1 
            GraphicsWindow.PenWidth = 3 
            GraphicsWindow.PenColor = "Black" 
            GraphicsWindow.BrushColor = "DarkGray" 
            Rock[1] = Shapes.AddEllipse(30, 40) 
            Rock[2] = Shapes.AddEllipse(30, 40) 
            Rock[3] = Shapes.AddEllipse(30, 40) 
            Rock[4] = Shapes.AddEllipse(30, 40) 
            Shapes.Move(Rock[1], 315, 205) 
            Shapes.Move(Rock[2], 755, 205) 
            Shapes.Move(Rock[3], 315, 355) 
            Shapes.Move(Rock[4], 755, 355) 
            'Place Daniel 
            DanielImage = ImageList.LoadImage(Program.Directory + 
    "\Daniel.jpg") 
            Daniel = Shapes.AddImage(DanielImage) 
            PlaceDaniel: 
            Row = Math.GetRandomNumber(10) 
            Column = Math.GetRandomNumber(20) 
            If (A[Row][Column] = 0) Then 
              A[Row][Column] = 3 
              DanielRow = Row 
              DanielColumn = Column 
              Shapes.Move(Daniel, DanielColumn * 40 + 115, DanielRow * 
    50 +5) 
            Else 
              Goto PlaceDaniel 
            EndIf 
            'Place lions 
            LionImage = ImageList.LoadImage(Program.Directory + 
    "\Lion.jpg") 
            For i = 1 To NumberLions 
              Lion[i] = Shapes.AddImage(LionImage) 
              PlaceLion: 
              Row = Math.GetRandomNumber(10) 
              Column = Math.GetRandomNumber(20) 
              If (A[Row][Column] = 0) Then 
                A[Row][Column] = 2 
                LionRow[i] = Row 
                LionColumn[i] = Column 
                Shapes.Move(Lion[i], LionColumn[i] * 40 + 115, 
    LionRow[i] * 50 +5) 
              Else 
                Goto PlaceLion 
              EndIf 
            Endfor

     

    EndIf 
        ElseIf (Y > 260 And Y < 290) Then 
          If (X > 5 And X < 95) Then 
            'clicked stop 
            Program.End() 
          EndIf 
        EndIf 
      ElseIf (GameStatus = "DanielMove") Then 
        'clicks on move buttons 
        MoveMade = "false" 
        If (X > 5 And X < 95) Then 
          If (Y > 320 And Y < 410) Then 
            DeltaRow = Math.Floor((Y ‐ 320) / 30) ‐ 1 
            DeltaColumn = Math.Floor((X ‐ 5) / 30) ‐ 1 
            CheckMove() 
          EndIf 
        EndIf 
        'clicks on shoot buttons 
        If (X > 5 And X < 95) Then 
          If (Y > 450 And Y < 540) Then 
            DeltaRow = Math.Floor((Y ‐ 450) / 30) ‐ 1 
            DeltaColumn = Math.Floor((X ‐ 5) / 30) ‐ 1 
            If (DeltaRow <> 0 Or DeltaColumn <> 0) Then 
              Moves = Moves + 1 
              MoveMade = "true" 
            EndIf 
            PrayerRow = DanielRow 
            PrayerColumn = DanielColumn 
            MoveAgain: 
            'check if move is okay 
            PrayerRow = PrayerRow + DeltaRow 
            PrayerColumn = PrayerColumn + DeltaColumn 
            MoveOkay = "true" 
            If (PrayerRow < 1 Or PrayerRow > 10 Or PrayerColumn < 1 Or 
    PrayerColumn > 20 Or (DeltaRow = 0 And DeltaColumn = 0)) Then 
              ' off grid or center button area clicked 
              MoveOkay = "false" 
            ElseIf (A[PrayerRow][PrayerColumn] = 1) Then 
              'moving to rock 
              MoveOkay = "false" 
            EndIf 
            If (A[PrayerRow][PrayerColumn] = 2) Then 
              ' dispatched a lion ‐ find that lion 
              For i = 1 to NumberLions 
                If (PrayerRow = LionRow[i] And PrayerColumn = 
    LionColumn[i]) Then

       

    Goto FoundHim 
                EndIf 
              EndFor 
              FoundHim: 
              MoveOkay = "false" 
              A[PrayerRow][PrayerColumn] = 0 
              LionRow[i] = 0 
              LionColumn[i] = 0 
              Shapes.Remove(Lion[i]) 
              Sound.PlayChime() 
              LionsLeft = LionsLeft ‐ 1 
              If (LionsLeft = 0) Then 
                GameOver = "true" 
              EndIf 
            EndIf 
            If (MoveOkay = "true") Then 
              Goto MoveAgain 
            Endif 
          EndIf 
        EndIf 
        UpdateGame() 
      EndIf 
      If (GameStatus <> "Initial") Then 
        If (Y > 260 And Y < 290) Then 
          If (X > 5 And X < 95) Then 
            'clicked stop while playing 
            GameStatus = "Initial" 
            GraphicsWindow.ShowMessage("You stopped the game.", "Game 
    Over") 
            For i = 1 To NumberLions 
              Shapes.Remove(Lion[i]) 
            EndFor 
            Shapes.Remove(Daniel) 
          EndIf 
        EndIf 
      EndIf 
    EndSub 

    Sub DisplayMovesLions 
      GraphicsWindow.FontSize = 18 
      GraphicsWindow.BrushColor = "Blue" 
      GraphicsWindow.FillRectangle(0, 40, 100, 20) 
      GraphicsWindow.FillRectangle(0, 90, 100, 20) 
      GraphicsWindow.BrushColor = "White" 
      GraphicsWindow.DrawText(35, 40, Moves) 
      GraphicsWindow.DrawText(35, 90, LionsLeft) 

        

    EndSub 

    Sub CheckMove 
      Moves = Moves + 1 
      MoveMade = "true" 
      'check if move is okay 
      NewRow = DanielRow + DeltaRow 
      NewColumn = DanielColumn + DeltaColumn 
      MoveOkay = "true" 
      If (NewRow < 1 Or NewRow > 10 Or NewColumn < 1 Or NewColumn > 
    20) Then 
        ' off grid 
        MoveOkay = "false" 
      ElseIf (A[NewRow][NewColumn] = 1) Then 
        'moving to rock 
        MoveOkay = "false" 
      ElseIf (A[NewRow][NewColumn] = 2) Then 
        'moving to lion 
        MoveOkay = "false" 
        GameOver = "true" 
        Shapes.Remove(Daniel) 
      EndIf 
      If (MoveOkay = "true") Then 
        Shapes.Animate(Daniel, NewColumn * 40 + 115, NewRow * 50 +5, 
    200) 
        A[DanielRow][DanielColumn] = 0 
        DanielRow = NewRow 
        DanielColumn = NewColumn 
        A[DanielRow][DanielColumn] = 3 
      EndIf 
    EndSub 

    Sub KeyDownEvent 
      If (GameStatus = "DanielMove") Then 
        'Daniel options ‐ move using keypad 
        MoveMade = "false" 
        K = GraphicsWindow.LastKey 
        If (K = "NumPad7") Then 
          DeltaRow = ‐1 
          DeltaColumn = ‐1 
          CheckMove() 
        EndIf 
        If (K = "NumPad8") Then 
          DeltaRow = ‐1 
          DeltaColumn = 0 
          CheckMove()

     

    EndIf 
        If (K = "NumPad9") Then 
          DeltaRow = ‐1 
          DeltaColumn = 1 
          CheckMove() 
        EndIf 
        If (K = "NumPad4") Then 
          DeltaRow = 0 
          DeltaColumn = ‐1 
          CheckMove() 
        EndIf 
        If (K = "NumPad5") Then 
          DeltaRow = 0 
          DeltaColumn = 0 
          CheckMove() 
        EndIf 
        If (K = "NumPad6") Then 
          DeltaRow = 0 
          DeltaColumn = 1 
          CheckMove() 
        EndIf 
        If (K = "NumPad1") Then 
          DeltaRow = 1 
          DeltaColumn = ‐1 
          CheckMove() 
        EndIf 
        If (K = "NumPad2") Then 
          DeltaRow = 1 
          DeltaColumn = 0 
          CheckMove() 
        EndIf 
        If (K = "NumPad3") Then 
          DeltaRow = 1 
          DeltaColumn = 1 
          CheckMove() 
        EndIf 
        UpdateGame() 
      EndIf 
    EndSub 

    Sub UpdateGame 
      DisplayMovesLions() 
      If (MoveMade = "true" And GameOver = "false") Then 
        'move lions  
        MoveLions() 
      EndIf

        

    If (GameOver = "true") Then 
        'game is over 
        GameOverMessage() 
      EndIf 
    EndSub 


    Sub MoveLions 
      GameStatus = "LionsMove" 
      For i = 1 To NumberLions 
        If (A[LionRow[i]][LionColumn[i]] = 2) Then 
          If (LionRow[i] > DanielRow) Then 
            DeltaRow = ‐1 
          ElseIf (LionRow[i] < DanielRow) Then 
            DeltaRow = 1 
          Else 
            DeltaRow = 0 
          EndIf  
          If (LionColumn[i] > DanielColumn) Then 
            DeltaColumn = ‐1 
          ElseIf (LionColumn[i] < DanielColumn) Then 
            DeltaColumn = 1 
          Else 
            DeltaColumn = 0 
          EndIf  
          NewRow = LionRow[i] + DeltaRow 
          NewColumn = LionColumn[i] + DeltaColumn 
          MoveOkay = "true" 
          If (NewRow < 1 Or NewRow > 10 Or NewColumn < 1 Or NewColumn 
    > 20) Then 
            ' off grid 
            MoveOkay = "false" 
          ElseIf (A[NewRow][NewColumn] = 1) Then 
            'moving to rock 
            MoveOkay = "false" 
          ElseIf (A[NewRow][NewColumn] = 2) Then 
            'moving to another lion 
            MoveOkay = "false" 
          EndIf 
          If (MoveOkay = "true") Then 
            If (A[NewRow][NewColumn] = 3) Then 
              'moving to Daniel 
              GameOver = "true" 
              Shapes.Remove(Daniel) 
            EndIf

     

    Shapes.Animate(Lion[i], NewColumn * 40 + 115, NewRow * 50 
    +5, 500) 
            A[LionRow[i]][LionColumn[i]] = 0 
            LionRow[i] = NewRow 
            LionColumn[i] = NewColumn 
            A[LionRow[i]][LionColumn[i]] = 2 
          EndIf 
        EndIf 
      EndFor 
      GameStatus = "DanielMove" 
    EndSub 

    Sub GameOverMessage 
      GameStatus = "Initial" 
      If (LionsLeft > 0) Then 
        GraphicsWindow.ShowMessage("Daniel met a lion but God shut the 
    mouth of the lion at the last minute and King Darius released 
    Daniel from the Lion's Den.", "Game Over") 
        For i = 1 To NumberLions 
          Shapes.Remove(Lion[i]) 
        EndFor 
      Else 
        GraphicsWindow.ShowMessage("Daniel dispatched " + NumberLions 
    + " lions in " + Moves + " moves.", "Game Over") 
        Shapes.Remove(Daniel) 
      EndIf 
    EndSub 

    Thanks !

    Tuesday, June 24, 2014 3:59 PM
  • GameMaker91,

    This program has the same errors as Elijah.sb !!!!

    I changed the unknown characters to minus(-) and the program runs. I place hereby the program which runs:

    EDIT: because I don't have the necessary  images, that part doesn't work.

    ' Daniel and the Lions 
    ' Small Basic Version 
    
    ' Intro screen 
    IntroScreen: 
    Difficulty = 1 
    GameStatus = "Initial" 
    GraphicsWindow.Show() 
    GraphicsWindow.Title = "Daniel and the Lions" 
    GraphicsWindow.BackgroundColor = "White" 
    GraphicsWindow.Width = 1000 
    GraphicsWindow.Height = 700 
    GraphicsWindow.BrushColor = "Black" 
    GraphicsWindow.FontSize = 14 
    GraphicsWindow.DrawText(110, 10, "DANIEL AND THE LIONS") 
    GraphicsWindow.DrawText(110, 30, "In Daniel 6:16‐28, King Darius is tricked into putting Daniel into the Lions Den. Daniel prays for God’s protection") 
    GraphicsWindow.DrawText(110, 50, "and God sends His Angel to shut the Lion’s mouth.  God will protect you if you pray to Him today.")  
    GraphicsWindow.DrawText(110, 180, "<‐‐ Select Difficulty by pressing the left button for Easy and the right button for Harder.")  
    GraphicsWindow.DrawText(110, 230, "<‐‐ Click on the Start Button to begin.") 
    GraphicsWindow.DrawText(110, 270, "<‐‐ Click on the Stop Button to stop the program.") 
    GraphicsWindow.DrawText(110, 360, "<‐‐ Use these buttons (or keypad keys) to move Daniel.") 
    GraphicsWindow.DrawText(110, 490, "<‐‐ Use these buttons to 'shoot' prayers at lions.") 
    GraphicsWindow.BrushColor = "Blue" 
    GraphicsWindow.FillRectangle(0, 0, 100, GraphicsWindow.Height) 
    GraphicsWindow.BrushColor = "Yellow" 
    GraphicsWindow.FontSize = 18 
    GraphicsWindow.DrawText(15, 20, "Moves:")
    
    
    GraphicsWindow.DrawText(20, 70, "Lions:") 
    GraphicsWindow.DrawText(5, 120, "Difficulty:") 
    GraphicsWindow.DrawText(25, 300, "Move") 
    GraphicsWindow.DrawText(20, 430, "Shoot") 
    GraphicsWindow.FontSize = 12 
    GraphicsWindow.DrawText(10, 410, "Click Middle") 
    GraphicsWindow.DrawText(10, 420, "For No Move") 
    GraphicsWindow.BrushColor = "White" 
    GraphicsWindow.FontSize = 18 
    GraphicsWindow.DrawText(35, 140, Difficulty) 
    GraphicsWindow.BrushColor = "LightGray" 
    GraphicsWindow.FillRectangle(15, 170, 30, 30) 
    GraphicsWindow.FillRectangle(55, 170, 30, 30) 
    GraphicsWindow.FillRectangle(5, 220, 90, 30) 
    GraphicsWindow.FillRectangle(5, 260, 90, 30) 
    GraphicsWindow.BrushColor = "Black" 
    GraphicsWindow.FontSize = 14 
    GraphicsWindow.DrawText(25, 175, "<") 
    GraphicsWindow.DrawText(65, 175, ">") 
    GraphicsWindow.DrawText(30, 225, "Start") 
    GraphicsWindow.DrawText(30, 265, "Stop") 
    MoveImage = ImageList.LoadImage(Program.Directory + "\MoveButtons.jpg") 
    MoveButtons = Shapes.AddImage(MoveImage) 
    Shapes.Move(MoveButtons, 5, 320) 
    ShootImage  = ImageList.LoadImage(Program.Directory + "\ShootButtons.jpg") 
    ShootButtons = Shapes.AddImage(ShootImage) 
    Shapes.Move(ShootButtons, 5, 450) 
    GraphicsWindow.MouseDown = MouseDownEvent 
    GraphicsWindow.KeyDown = KeyDownEvent 
    
    Sub MouseDownEvent 
      X = GraphicsWindow.MouseX 
      Y = GraphicsWindow.MouseY 
      If (GameStatus = "Initial") Then 
        If (Y > 175 And Y < 205) Then 
          If (X > 15 And X < 45) Then 
            ' decrease difficulty 
            Difficulty = Difficulty - 1 
            If (Difficulty < 1) Then 
              Difficulty = 1 
            EndIf 
          ElseIf (X > 55 And X < 85) Then 
            'increase difficulty 
            Difficulty = Difficulty + 1 
            
            If (Difficulty > 10) Then 
              Difficulty = 10 
            EndIf 
          EndIf 
          GraphicsWindow.BrushColor = "Blue" 
          GraphicsWindow.FillRectangle(0, 140, 100, 20) 
          GraphicsWindow.BrushColor = "White" 
          GraphicsWindow.FontSize = 18 
          GraphicsWindow.DrawText(35, 140, Difficulty) 
        ElseIf (Y > 220 And Y < 250) Then 
          If (X > 5 And X < 95) Then 
            'clicked start 
            GameStatus = "DanielMove" 
            GameOver = "false" 
            GraphicsWindow.BrushColor = "White" 
            GraphicsWindow.FillRectangle(100, 0, GraphicsWindow.Width - 100, GraphicsWindow.Height) 
            Moves = 0 
            NumberLions = Difficulty + 5 
            LionsLeft = NumberLions 
            DisplayMovesLions() 
            '  draw grid structure 
            GraphicsWindow.BrushColor = "Black" 
            GraphicsWindow.FillRectangle(145, 45, 810, 510) 
            GraphicsWindow.BrushColor = "White" 
            GraphicsWindow.FillRectangle(150, 50, 800, 500) 
            GraphicsWindow.PenWidth = 1 
            GraphicsWindow.PenColor = "Gray" 
            For i = 1 to 9 
              GraphicsWindow.DrawLine(150, (i + 1) * 50, 950, (i + 1) * 50) 
            EndFor 
            For i = 1 to 19 
              GraphicsWindow.DrawLine(150 + i * 40, 50, 150 + i * 40, 550) 
            EndFor 
            For i = 1 to 10 
              For j = 1 to 20 
                A[i][j] = 0 
              EndFor 
            EndFor 
            '  Place rocks 
            ' A array (0‐ nothing, 1‐rock, 2‐lion, 3‐Daniel) 
            A[4][5] = 1 
            A[4][16] = 1 
            A[7][5] = 1 
            
            A[7][16] = 1 
            GraphicsWindow.PenWidth = 3 
            GraphicsWindow.PenColor = "Black" 
            GraphicsWindow.BrushColor = "DarkGray" 
            Rock[1] = Shapes.AddEllipse(30, 40) 
            Rock[2] = Shapes.AddEllipse(30, 40) 
            Rock[3] = Shapes.AddEllipse(30, 40) 
            Rock[4] = Shapes.AddEllipse(30, 40) 
            Shapes.Move(Rock[1], 315, 205) 
            Shapes.Move(Rock[2], 755, 205) 
            Shapes.Move(Rock[3], 315, 355) 
            Shapes.Move(Rock[4], 755, 355) 
            'Place Daniel 
            DanielImage = ImageList.LoadImage(Program.Directory + "\Daniel.jpg") 
            Daniel = Shapes.AddImage(DanielImage) 
            PlaceDaniel: 
            Row = Math.GetRandomNumber(10) 
            Column = Math.GetRandomNumber(20) 
            If (A[Row][Column] = 0) Then 
              A[Row][Column] = 3 
              DanielRow = Row 
              DanielColumn = Column 
              Shapes.Move(Daniel, DanielColumn * 40 + 115, DanielRow * 50 +5) 
            Else 
              Goto PlaceDaniel 
            EndIf 
            'Place lions 
            LionImage = ImageList.LoadImage(Program.Directory + "\Lion.jpg") 
            For i = 1 To NumberLions 
              Lion[i] = Shapes.AddImage(LionImage) 
              PlaceLion: 
              Row = Math.GetRandomNumber(10) 
              Column = Math.GetRandomNumber(20) 
              If (A[Row][Column] = 0) Then 
                A[Row][Column] = 2 
                LionRow[i] = Row 
                LionColumn[i] = Column 
                Shapes.Move(Lion[i], LionColumn[i] * 40 + 115, LionRow[i] * 50 +5) 
              Else 
                Goto PlaceLion 
              EndIf 
            Endfor
            
          EndIf 
        ElseIf (Y > 260 And Y < 290) Then 
          If (X > 5 And X < 95) Then 
            'clicked stop 
            Program.End() 
          EndIf 
        EndIf 
      ElseIf (GameStatus = "DanielMove") Then 
        'clicks on move buttons 
        MoveMade = "false" 
        If (X > 5 And X < 95) Then 
          If (Y > 320 And Y < 410) Then 
            DeltaRow = Math.Floor((Y - 320) / 30) - 1 
            DeltaColumn = Math.Floor((X - 5) / 30) - 1 
            CheckMove() 
          EndIf 
        EndIf 
        'clicks on shoot buttons 
        If (X > 5 And X < 95) Then 
          If (Y > 450 And Y < 540) Then 
            DeltaRow = Math.Floor((Y - 450) / 30) - 1 
            DeltaColumn = Math.Floor((X - 5) / 30) - 1 
            If (DeltaRow <> 0 Or DeltaColumn <> 0) Then 
              Moves = Moves + 1 
              MoveMade = "true" 
            EndIf 
            PrayerRow = DanielRow 
            PrayerColumn = DanielColumn 
            MoveAgain: 
            'check if move is okay 
            PrayerRow = PrayerRow + DeltaRow 
            PrayerColumn = PrayerColumn + DeltaColumn 
            MoveOkay = "true" 
            If (PrayerRow < 1 Or PrayerRow > 10 Or PrayerColumn < 1 Or PrayerColumn > 20 Or (DeltaRow = 0 And DeltaColumn = 0)) Then 
              ' off grid or center button area clicked 
              MoveOkay = "false" 
            ElseIf (A[PrayerRow][PrayerColumn] = 1) Then 
              'moving to rock 
              MoveOkay = "false" 
            EndIf 
            If (A[PrayerRow][PrayerColumn] = 2) Then 
              ' dispatched a lion P find that lion 
              For i = 1 to NumberLions 
                If (PrayerRow = LionRow[i] And PrayerColumn = LionColumn[i]) Then
                  
                  
                  Goto FoundHim 
                EndIf 
              EndFor 
              FoundHim: 
              MoveOkay = "false" 
              A[PrayerRow][PrayerColumn] = 0 
              LionRow[i] = 0 
              LionColumn[i] = 0 
              Shapes.Remove(Lion[i]) 
              Sound.PlayChime() 
              LionsLeft = LionsLeft - 1 
              If (LionsLeft = 0) Then 
                GameOver = "true" 
              EndIf 
            EndIf 
            If (MoveOkay = "true") Then 
              Goto MoveAgain 
            Endif 
          EndIf 
        EndIf 
        UpdateGame() 
      EndIf 
      If (GameStatus <> "Initial") Then 
        If (Y > 260 And Y < 290) Then 
          If (X > 5 And X < 95) Then 
            'clicked stop while playing 
            GameStatus = "Initial" 
            GraphicsWindow.ShowMessage("You stopped the game.", "Game Over") 
            For i = 1 To NumberLions 
              Shapes.Remove(Lion[i]) 
            EndFor 
            Shapes.Remove(Daniel) 
          EndIf 
        EndIf 
      EndIf 
    EndSub 
    
    Sub DisplayMovesLions 
      GraphicsWindow.FontSize = 18 
      GraphicsWindow.BrushColor = "Blue" 
      GraphicsWindow.FillRectangle(0, 40, 100, 20) 
      GraphicsWindow.FillRectangle(0, 90, 100, 20) 
      GraphicsWindow.BrushColor = "White" 
      GraphicsWindow.DrawText(35, 40, Moves) 
      GraphicsWindow.DrawText(35, 90, LionsLeft) 
      
      
    EndSub 
    
    Sub CheckMove 
      Moves = Moves + 1 
      MoveMade = "true" 
      'check if move is okay 
      NewRow = DanielRow + DeltaRow 
      NewColumn = DanielColumn + DeltaColumn 
      MoveOkay = "true" 
      If (NewRow < 1 Or NewRow > 10 Or NewColumn < 1 Or NewColumn > 20) Then 
        ' off grid 
        MoveOkay = "false" 
      ElseIf (A[NewRow][NewColumn] = 1) Then 
        'moving to rock 
        MoveOkay = "false" 
      ElseIf (A[NewRow][NewColumn] = 2) Then 
        'moving to lion 
        MoveOkay = "false" 
        GameOver = "true" 
        Shapes.Remove(Daniel) 
      EndIf 
      If (MoveOkay = "true") Then 
        Shapes.Animate(Daniel, NewColumn * 40 + 115, NewRow * 50 +5, 200) 
        A[DanielRow][DanielColumn] = 0 
        DanielRow = NewRow 
        DanielColumn = NewColumn 
        A[DanielRow][DanielColumn] = 3 
      EndIf 
    EndSub 
    
    Sub KeyDownEvent 
      If (GameStatus = "DanielMove") Then 
        'Daniel options ‐ move using keypad 
        MoveMade = "false" 
        K = GraphicsWindow.LastKey 
        If (K = "NumPad7") Then 
          DeltaRow = -1 
          DeltaColumn = -1 
          CheckMove() 
        EndIf 
        If (K = "NumPad8") Then 
          DeltaRow = -1 
          DeltaColumn = 0 
          CheckMove()
          
          
        EndIf 
        If (K = "NumPad9") Then 
          DeltaRow = -1 
          DeltaColumn = 1 
          CheckMove() 
        EndIf 
        If (K = "NumPad4") Then 
          DeltaRow = 0 
          DeltaColumn = -1 
          CheckMove() 
        EndIf 
        If (K = "NumPad5") Then 
          DeltaRow = 0 
          DeltaColumn = 0 
          CheckMove() 
        EndIf 
        If (K = "NumPad6") Then 
          DeltaRow = 0 
          DeltaColumn = 1 
          CheckMove() 
        EndIf 
        If (K = "NumPad1") Then 
          DeltaRow = 1 
          DeltaColumn = -1 
          CheckMove() 
        EndIf 
        If (K = "NumPad2") Then 
          DeltaRow = 1 
          DeltaColumn = 0 
          CheckMove() 
        EndIf 
        If (K = "NumPad3") Then 
          DeltaRow = 1 
          DeltaColumn = 1 
          CheckMove() 
        EndIf 
        UpdateGame() 
      EndIf 
    EndSub 
    
    Sub UpdateGame 
      DisplayMovesLions() 
      If (MoveMade = "true" And GameOver = "false") Then 
        'move lions  
        MoveLions() 
      EndIf
      
      
      If (GameOver = "true") Then 
        'game is over 
        GameOverMessage() 
      EndIf 
    EndSub 
    
    
    Sub MoveLions 
      GameStatus = "LionsMove" 
      For i = 1 To NumberLions 
        If (A[LionRow[i]][LionColumn[i]] = 2) Then 
          If (LionRow[i] > DanielRow) Then 
            DeltaRow = -1 
          ElseIf (LionRow[i] < DanielRow) Then 
            DeltaRow = 1 
          Else 
            DeltaRow = 0 
          EndIf  
          If (LionColumn[i] > DanielColumn) Then 
            DeltaColumn = -1 
          ElseIf (LionColumn[i] < DanielColumn) Then 
            DeltaColumn = 1 
          Else 
            DeltaColumn = 0 
          EndIf  
          NewRow = LionRow[i] + DeltaRow 
          NewColumn = LionColumn[i] + DeltaColumn 
          MoveOkay = "true" 
          If (NewRow < 1 Or NewRow > 10 Or NewColumn < 1 Or NewColumn > 20) Then 
            ' off grid 
            MoveOkay = "false" 
          ElseIf (A[NewRow][NewColumn] = 1) Then 
            'moving to rock 
            MoveOkay = "false" 
          ElseIf (A[NewRow][NewColumn] = 2) Then 
            'moving to another lion 
            MoveOkay = "false" 
          EndIf 
          If (MoveOkay = "true") Then 
            If (A[NewRow][NewColumn] = 3) Then 
              'moving to Daniel 
              GameOver = "true" 
              Shapes.Remove(Daniel) 
            EndIf
            
            
            Shapes.Animate(Lion[i], NewColumn * 40 + 115, NewRow * 50 +5, 500) 
            A[LionRow[i]][LionColumn[i]] = 0 
            LionRow[i] = NewRow 
            LionColumn[i] = NewColumn 
            A[LionRow[i]][LionColumn[i]] = 2 
          EndIf 
        EndIf 
      EndFor 
      GameStatus = "DanielMove" 
    EndSub 
    
    Sub GameOverMessage 
      GameStatus = "Initial" 
      If (LionsLeft > 0) Then 
        GraphicsWindow.ShowMessage("Daniel met a lion but God shut the mouth of the lion at the last minute and King Darius released Daniel from the Lion's Den.", "Game Over") 
        For i = 1 To NumberLions 
          Shapes.Remove(Lion[i]) 
        EndFor 
      Else 
        GraphicsWindow.ShowMessage("Daniel dispatched " + NumberLions + " lions in " + Moves + " moves.", "Game Over") 
        Shapes.Remove(Daniel) 
      EndIf 
    EndSub 


    Jan [ WhTurner ] The Netherlands


    Tuesday, June 24, 2014 5:50 PM
    Answerer
  • Jan, some images are here BIBLE GAMES FOR MS SB

    But i did'nt try and don't know, if they fit (eg. size).

    Tuesday, June 24, 2014 6:19 PM
    Answerer