none
Shapes Poloha RRS feed

  • Question

  • Sub Miesto
           If Controls.LastClickedButton = miesto1   Then  
             Controls.HideControl(miesto1)
             Controls.HideControl(miesto2)
           Controls.HideControl(miesto3)
           Controls.HideControl(miesto4)
             Controls.Move(sekernik1, 630, 360)
           Shapes.Animate(drevo, 630, 280, 1000)
           Shapes.Animate(kamen, 725, 270, 1000)

         ElseIf Controls.LastClickedButton = miesto2 Then
           Controls.HideControl(miesto1)
           Controls.HideControl(miesto2)
           Controls.HideControl(miesto3)
           Controls.HideControl(miesto4)
             Controls.Move(sekernik1, 830, 160)
           Shapes.Animate(drevo, 830, 80, 1000)
           Shapes.Animate(kamen, 925, 70, 1000)

           ElseIf Controls.LastClickedButton = miesto3  Then
                  Controls.HideControl(miesto1)
            Controls.HideControl(miesto2)
            Controls.HideControl(miesto3)
            Controls.HideControl(miesto4)
                 Controls.Move(sekernik1, 830, 560)
           Shapes.Animate(drevo, 830, 480, 1000)
           Shapes.Animate(kamen, 925, 470, 1000) 

         ElseIf Controls.LastClickedButton = miesto4 Then   
                    Controls.HideControl(miesto1)
            Controls.HideControl(miesto2)
            Controls.HideControl(miesto3)
            Controls.HideControl(miesto4)
          Controls.Move(sekernik1, 1030, 360)
          Shapes.Animate(drevo, 1030, 280, 1000)
         Shapes.Animate(kamen, 1125, 270, 1000)                   
       EndIf

       If Controls.LastClickedButton = miesto1 Then

         If j = 1 Or j = 2 Or j = 4 Or  j = 5 Or  j = 6 Then
       miesto5 = Controls.AddButton(" ", 500, 300)
       Controls.SetSize(miesto5, 30, 30)
       EndIf

    If d = 1 Or d = 2 Or d = 4 Or  d = 5 Or  d = 6 Then
        miesto6 = Controls.AddButton(" ", 700, 100)
       Controls.SetSize(miesto6, 30, 30)
       EndIf

          If l = 1 Or l = 2 Or l = 3 Or  l = 4 Or  l = 5 Then
        miesto7 = Controls.AddButton(" ", 900, 300)
        Controls.SetSize(miesto7, 30, 30)
      EndIf

       If p = 1 Or p = 2 Or p = 4 Or  p = 5 Or  p = 6 Then
        miesto8 = Controls.AddButton(" ", 700, 500)
        Controls.SetSize(miesto8, 30, 30)
       EndIf


       Controls.ButtonClicked = Miesto_2
       EndIf
         EndSub


         Sub Miesto_2
           If Controls.LastClickedButton = miesto5   Then  
             Controls.HideControl(miesto5)
             Controls.HideControl(miesto6)
           Controls.HideControl(miesto7)
           Controls.HideControl(miesto8)
             Controls.Move(sekernik1, 430, 360)
           Shapes.Animate(drevo, 430, 280, 1000)
           Shapes.Animate(kamen, 525, 270, 1000)

         ElseIf Controls.LastClickedButton = miesto6 Then
           Controls.HideControl(miesto5)
           Controls.HideControl(miesto6)
           Controls.HideControl(miesto7)
           Controls.HideControl(miesto8)
             Controls.Move(sekernik1, 630, 160)
           Shapes.Animate(drevo, 630, 80, 1000)
           Shapes.Animate(kamen, 725, 70, 1000)

                ElseIf Controls.LastClickedButton = miesto7 Then   
                    Controls.HideControl(miesto5)
            Controls.HideControl(miesto6)
            Controls.HideControl(miesto7)
            Controls.HideControl(miesto8)
          Controls.Move(sekernik1, 830, 360)
          Shapes.Animate(drevo, 830, 280, 1000)
         Shapes.Animate(kamen, 925, 270, 1000)  



      ElseIf Controls.LastClickedButton = miesto8  Then
                  Controls.HideControl(miesto5)
            Controls.HideControl(miesto6)
            Controls.HideControl(miesto7)
            Controls.HideControl(miesto8)
                 Controls.Move(sekernik1, 630, 560)
           Shapes.Animate(drevo, 630, 480, 1000)
           Shapes.Animate(kamen, 725, 470, 1000) 
         EndIf


           EndSub

    Ide o to že keď sa tvary presunú z 1. polohy na 2. polohu a potom späť na 1. polohu už sa z 1. polohy nedá hýbať 

    Ako sa dá tento problém Vyriešiť?           ĎAKUJEM ZA VÁŠ ČAS!

                                                                                                   
    Sunday, March 25, 2018 4:34 PM

Answers

  • To analyze what your program is doing, I first tried to convert the first about 1100 lines of the Sub Clickplay. You have a lot of the same lines, so I tried to convert these to the use of loops. Those 1100 lines can be reduced to about 45 lines. By shifting the "water" cells to randomnumber=6 , 
    you can easily detect for water by checking for  variable>5 is water and variable<6 not water.
    For the logic of movement it is perhaps better to characterize each cell by x (0 to 6) and y (0 to 3). Then movement to UP is x=x-1, to RIGHT is y=y+1. 
    From these coordinates you can easily calculate the position of this cell, without "hardcoding" the coordinates 200 400 etcetera.

    After that I made the movement of the player (Sekernik1) without controlbuttonss, which makes the program much shorter. Here is the program (110 lines), which does what I think you want to do. 
    GraphicsWindow.Left=0
    GraphicsWindow.Top=0
    GraphicsWindow.Width=1600
    GraphicsWindow.Height=1000
    color="1=ForestGreen;2=GreenYellow;3=Gainsboro;4=Goldenrod;5=SlateGray;6=Aqua"
    txt="1=LES;2=PASTVINA;3=SKALY;4=LUKA;5=ZELEZO;6=VODA"
    size=200   ''of the cells
    sizeH=size/2
    GraphicsWindow.FontSize = size/10
    x0=0  '' min x
    x1=6  '' max x
    y1=3  '' max y
    
    For y=0 To y1     ''draw cells
      yp=y*size  ''number of pixels
      If y>1 Then
        x0=2
      EndIf
      For x=x0 To x1
        xp=x*size  
        a = Math.GetRandomNumber(6)
        While a=6 and y=1 and (x=3 or x=4)  ''cells K and L no water
          a = Math.GetRandomNumber(6)
        EndWhile
        GraphicsWindow.BrushColor = color[a]
        GraphicsWindow.FillRectangle(xp, yp, size, size)
        GraphicsWindow.BrushColor = "White"
        GraphicsWindow.DrawText(9+xp, yp+sizeH, txt[a])
        cell[x][y]=a
      EndFor
    EndFor
    
    For x=size To (x1+1)*size Step size   ''lines between cells
      GraphicsWindow.DrawLine(x, 0, x, 6*size)
    EndFor
    For y=0 To 6*size Step size
      GraphicsWindow.DrawLine(0, y, (x1+1)*size, y)
    EndFor
    
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FillRectangle(0,6*size,(x1+1)*size,400)   ''0, 1200, 2000, 500
    GraphicsWindow.FillRectangle((x1+1)*size, 0, 20, 7*size)
    
    GraphicsWindow.FillRectangle(0,2*size,2*size,2*size)
    GraphicsWindow.FontSize = size/5
    GraphicsWindow.DrawLine(0, 2*size, 2*size, 2*size)
    GraphicsWindow.DrawLine(2*size, 2*size, 2*size, 2*size)
    
    tah = Controls.AddButton("SKONČIŤ ŤAH", 0, 2*size)
    Controls.SetSize(tah, 2*size, 0.3*size)
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FillRectangle(0, 2*size, 2*size, 2*size)
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillRectangle(0.3*size, 2.6*size, 1.4*size, 0.8*size)
    GraphicsWindow.BrushColor = "Gainsboro"
    GraphicsWindow.FillRectangle(0.3*size, 3*size, 0.4*size,0.4*size)  
    
    GraphicsWindow.PenColor = "Black"
    y11=2.6*size
    y22=3.4*size
    GraphicsWindow.DrawLine(sizeH, y11, sizeH, 3*size)      '280,  160  vert
    For x=1 To x1  ''
      x11=sizeH+size/5*x
      GraphicsWindow.DrawLine(x11, y11, x11, y22)
    EndFor
    
    GraphicsWindow.DrawLine(0, 2.8*size, 1.75*size, 2.8*size)
    GraphicsWindow.DrawLine(0, 3*size, 1.75*size, 3*size)
    GraphicsWindow.DrawLine(0.7*size, 3.2*size, 1.75*size, 3.2*size)
    GraphicsWindow.DrawLine(0.7*size, 3.4*size, 1.75*size, 3.4*size)
    xs=4  ''starting position
    ys=1
    GraphicsWindow.BrushColor = "Brown"
    drevo = Shapes.AddRectangle(sizeH, size/8)
    Shapes.Move(drevo,4.15*size, 1.4*size)
    GraphicsWindow.BrushColor = "DimGray"
    kamen = Shapes.AddRectangle(0.175*size, 0.3*size)
    Shapes.Move(kamen, 4.6*size, 1.3*size)
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FontSize = size/10
    sekernik1 = Controls.AddButton("SEKERNÍK ", 4.15*size, 1.7*size )
    Controls.SetSize(sekernik1, 0.7*size, 0.25*size)
    Controls.ButtonClicked = SubSekernik1
    GraphicsWindow.MouseDown=MouseDn
    
    Sub SubSekernik1   ' add menu
      GraphicsWindow.BrushColor = "Black"
      GraphicsWindow.FontSize = 15
      GraphicsWindow.DrawText( 1420, 20, "Sekerník ")
      pohyb = Controls.AddButton("POHYB", 1420, 100)
      spät = Controls.AddButton("SPÁNOK", 1420, 180)
      uzdravenie = Controls.AddButton("UZDRAVENIE", 1420, 220)
      GraphicsWindow.DrawText(1420, 250, "Zdravie: 10")
    EndSub
    
    Sub MouseDn   ''  move player
      xp=GraphicsWindow.MouseX
      yp=GraphicsWindow.MouseY
      xp=Math.Floor(xp/size)
      yp=Math.Floor(yp/size) 
      If (Math.Abs(xs-xp)<2 and ys=yp) or (Math.Abs(ys-yp)<2 and xs=xp) Then  ''only one cell vertically or horizontaly
        If 0+cell[xp][yp]>0 and cell[xp][yp]<>6 Then   '' outside of playing field or water
          Shapes.Animate(drevo,(xp+0.15)*size, (yp+0.4)*size,1000)
          Shapes.Animate(kamen,(xp+0.6)*size, (yp+0.3)*size,1000)
          Shapes.Animate(sekernik1,(xp+0.15)*size,(yp+0.7)*size,1000)
          xs=xp
          ys=yp
        EndIf
      EndIf
    EndSub

    Jan [ WhTurner ] The Netherlands


    Sunday, April 1, 2018 2:38 PM
    Answerer

All replies

  • Part of a program cannot be tested by us. Can you publish the whole program?

    Jan [ WhTurner ] The Netherlands

    Sunday, March 25, 2018 5:15 PM
    Answerer
  •    
    GraphicsWindow.Width = Desktop.Width
    GraphicsWindow.Height = Desktop.Height 
    GraphicsWindow.Top = 0 
    GraphicsWindow.Left = 0 
    GraphicsWindow.Title = "The game"
    
    
    
    GraphicsWindow.Clear()
    
    
    GraphicsWindow.BackgroundColor = "BurlyWood"
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontSize = 15
    GraphicsWindow.DrawText(0, 0, "Možnosti okna pomocou Alt + Space")
    
    
    
    GraphicsWindow.FontSize = 45
    GraphicsWindow.BrushColor = "Red"
    GraphicsWindow.DrawText(500, 100, "Slovanské kráľovstvo")
    GraphicsWindow.BrushColor = "Brown"
    
    play1 = Shapes.AddRectangle( 490, 75)
    Shapes.Move(play1, 100, 200)
    GraphicsWindow.FontSize = 30
    play = Controls.AddButton("PLAY", 325, 217)
    
    
    GraphicsWindow.BrushColor = "Brown"
    load1 = Shapes.AddRectangle(490, 75) 
    Shapes.Move(load1, 900, 200)
    load = Controls.AddButton("LOAD", 1125, 217)
    
    Controls.ButtonClicked = clickPLAY
    
    'Po kliknutí na PLAY
    Sub clickPLAY
      
      If Controls.LastClickedButton = PLAY Then 
        
       GraphicsWindow.Clear()
       GraphicsWindow.BackgroundColor = "White"
       
       a = Math.GetRandomNumber(6)
       If a = 1 Then 
         GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(0, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(90, 100, "LES")
    
    ElseIf a = 2 Then
      GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(0, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(80, 100, "PASTVINA")
         
       ElseIf a = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(0, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(80, 100, "VODA")
         
       ElseIf a = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(0, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(90, 100, "SKALY")
         
       ElseIf a = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(0, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(90, 100, "LÚKA")
         
       ElseIf a = 6 Then 
          GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(0, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(90, 100, "ŽELEZO")
         
       EndIf
       
       
       
      b = Math.GetRandomNumber(6)
       If b = 1 Then
         GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 100, "LES")
         
       ElseIf b = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 100, "PASTVINA")
         
       ElseIf b = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 100, "VODA")
         
       ElseIf b = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 100, "SKALY")
         
       ElseIf b = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 100, "LÚKA")
         
       ElseIf b = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 100, "ŽELEZO")
         
       EndIf
       
       
       c = Math.GetRandomNumber(6)
       If c = 1 Then
         GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(400, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 100, "LES")
         
       ElseIf c = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(400, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 100, "PASTVINA")
         
       ElseIf c = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(400, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 100, "VODA")
         
       ElseIf c = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(400, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 100, "SKALY")
         
       ElseIf c = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(400, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 100, "LÚKA")
         
       ElseIf c = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(400, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 100, "ŽELEZO")
         EndIf
         
         
         d = Math.GetRandomNumber(6)
       If d = 1 Then
         GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(600, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 100, "LES")
         
       ElseIf d = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(600, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 100, "PASTVINA")
         
       ElseIf d = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(600, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 100, "VODA")
         
       ElseIf d = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(600, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 100, "SKALY")
         
       ElseIf d = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(600, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 100, "LÚKA")
         
       ElseIf d = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(600, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 100, "ŽELEZO")
         EndIf
         
         e = Math.GetRandomNumber(6)
         If e = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(800, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 100, "LES")
         
       ElseIf e = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(800, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 100, "PASTVINA")
         
       ElseIf e = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(800, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 100, "VODA")
         
       ElseIf e = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(800, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 100, "SKALY")
         
       ElseIf e = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(800, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 100, "LÚKA")
         
       ElseIf e = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(800, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 100, "ŽELEZO")
         EndIf
         
         
         f = Math.GetRandomNumber(6)
         If f = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1000, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 100, "LES")
         
       ElseIf f = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1000, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 100, "PASTVINA")
         
       ElseIf f = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1000, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 100, "VODA")
         
       ElseIf f = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1000, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 100, "SKALY")
         
       ElseIf f = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1000, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 100, "LÚKA")
         
       ElseIf f = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1000, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 100, "ŽELEZO")
         EndIf
         
         
         g = Math.GetRandomNumber(6)
         If g = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 100, "LES")
         
       ElseIf g = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 100, "PASTVINA")
         
       ElseIf g = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 100, "VODA")
         
       ElseIf g = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 100, "SKALY")
         
       ElseIf g = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 100, "LÚKA")
         
       ElseIf g = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1200, 0, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 100, "ŽELEZO")
         EndIf
         
         
         
         h = Math.GetRandomNumber(6)
         If h = 1 Then
         GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(0, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(100, 300, "LES")
         
       ElseIf h = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(0, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(100, 300, "PASTVINA")
         
       ElseIf h = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(0, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(100, 300, "VODA")
         
       ElseIf h = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(0, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(100, 300, "SKALY")
         
       ElseIf h = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(0, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(100, 300, "LÚKA")
         
       ElseIf h = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(0, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(100, 300, "ŽELEZO")
    
    EndIf
    
    i = Math.GetRandomNumber(6)
    If i = 1 Then
      GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 300, "LES")
         
       ElseIf i = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 300, "PASTVINA")
         
       ElseIf i = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 300, "VODA")
         
       ElseIf i = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 300, "SKALY")
         
       ElseIf i = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 300, "LÚKA")
         
       ElseIf i = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(300, 300, "ŽELEZO")
         EndIf
         
         
         
         j = Math.GetRandomNumber(6)
         If j = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(400, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 300, "LES")
         
       ElseIf j = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(400, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 300, "PASTVINA")
         
       ElseIf j = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(400, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 300, "VODA")
         
       ElseIf j = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(400, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 300, "SKALY")
         
       ElseIf j = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(400, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 300, "LÚKA")
         
       ElseIf j = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(400, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 300, "ŽELEZO")
         EndIf
         
         
         
         k = Math.GetRandomNumber(5)
         If k = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(600, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 300, "LES")
         
       ElseIf k = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(600, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 300, "PASTVINA")
         
       ElseIf k = 3 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(600, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 300, "SKALY")
         
       ElseIf k = 4 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(600, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 300, "LÚKA")
         
       ElseIf k = 5 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(600, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 300, "ŽELEZO")
         EndIf
         
         
         l = Math.GetRandomNumber(5)
         If l = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(800, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 300, "LES")
         
       ElseIf l = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(800, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 300, "PASTVINA")
         
         
       ElseIf l = 3 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(800, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 300, "SKALY")
         
       ElseIf l = 4 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(800, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 300, "LÚKA")
         
       ElseIf l = 5 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(800, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 300, "ŽELEZO")
    EndIf
    
    
    
    m = Math.GetRandomNumber(6)
    If m = 1 Then
    GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1000, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 300, "LES")
         
       ElseIf m = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1000, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 300, "PASTVINA")
         
       ElseIf m = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1000, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 300, "VODA")
         
       ElseIf m = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1000, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 300, "SKALY")
         
       ElseIf m = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1000, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 300, "LÚKA")
         
       ElseIf m = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1000, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 300, "ŽELEZO")
    EndIf
    
    
    
    n = Math.GetRandomNumber(6)
    If n = 1 Then
      GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 300, "LES")
         
       ElseIf n = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 300, "PASTVINA")
         
       ElseIf n = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 300, "VODA")
         
       ElseIf n = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 300, "SKALY")
         
       ElseIf n = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 300, "LÚKA")
         
       ElseIf n = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1200, 200, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 300, "ŽELEZO")
      EndIf
      
      
      
      
      o = Math.GetRandomNumber(6)
      If o = 1 Then
        GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(400, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 500, "LES")
         
       ElseIf o = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(400, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 500, "PASTVINA")
         
       ElseIf o = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(400, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 500, "VODA")
         
       ElseIf o = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(400, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 500, "SKALY")
         
       ElseIf o = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(400, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 500, "LÚKA")
         
       ElseIf o = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(400, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 500, "ŽELEZO")
         EndIf
         
         
         
         
         p = Math.GetRandomNumber(6)
         If p = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(600, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 500, "LES")
         
       ElseIf p = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(600, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 500, "PASTVINA")
         
       ElseIf p = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(600, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 500, "VODA")
         
       ElseIf p = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(600, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 500, "SKALY")
         
       ElseIf p = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(600, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 500, "LÚKA")
         
       ElseIf p = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(600, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 500, "ŽELEZO")
         EndIf
         
         
         
         r = Math.GetRandomNumber(6)
         If r = 1 Then
         GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(800, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 500, "LES")
         
       ElseIf r = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(800, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 500, "PASTVINA")
         
          ElseIf r = 3 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(800, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 500, "ŽELEZO")  
         
         
       ElseIf r = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(800, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 500, "SKALY")
         
       ElseIf r = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(800, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 500, "LÚKA")
         
         
          ElseIf r = 6 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(800, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 500, "VODA")
         
         EndIf
         
         
         
         s = Math.GetRandomNumber(6)
         If s = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1000, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 500, "LES")
         
       ElseIf s = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1000, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 500, "PASTVINA")
         
       ElseIf s = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1000, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 500, "VODA")
         
       ElseIf s = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1000, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 500, "SKALY")
         
       ElseIf s = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1000, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 500, "LÚKA")
         
       ElseIf s = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1000, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 500, "ŽELEZO")
         EndIf
         
         
         
         t = Math.GetRandomNumber(6)
         If t = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1200, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 500, "LES")
         
       ElseIf t = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1200, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 500, "PASTVINA")
         
       ElseIf t = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1200, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 500, "VODA")
         
       ElseIf t = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1200, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 500, "SKALY")
         
       ElseIf t = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1200, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 500, "LÚKA")
         
       ElseIf t = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1200, 400, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 500, "ŽELEZO")
         EndIf
         
         
         
         u = Math.GetRandomNumber(6)
         If u = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(400, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 700, "LES")
         
       ElseIf u = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(400, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 700, "PASTVINA")
         
       ElseIf u = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(400, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 700, "VODA")
         
       ElseIf u = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(400, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 700, "SKALY")
         
       ElseIf u = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(400, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 700, "LÚKA")
         
       ElseIf u = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(400, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(500, 700, "ŽELEZO")
         EndIf
         
         
         
         v = Math.GetRandomNumber(6)
         If v = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(600, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 700, "LES")
         
       ElseIf v = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(600, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 700, "PASTVINA")
         
       ElseIf v = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(600, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 700, "VODA")
         
       ElseIf v = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(600, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 700, "SKALY")
         
       ElseIf v = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(600, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 700, "LÚKA")
         
       ElseIf v = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(600, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(700, 700, "ŽELEZO")
         EndIf
         
         
         
         y = Math.GetRandomNumber(6)
         If y = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(800, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 700, "LES")
         
       ElseIf y = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(800, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 700, "PASTVINA")
         
       ElseIf y = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(800, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 700, "VODA")
         
       ElseIf y = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(800, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 700, "SKALY")
         
       ElseIf y = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(800, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 700, "LÚKA")
         
       ElseIf y = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(800, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(900, 700, "ŽELEZO")
         EndIf
         
         
         
         z = Math.GetRandomNumber(6)
         If z = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1000, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 700, "LES")
         
       ElseIf z = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1000, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 700, "PASTVINA")
         
       ElseIf z = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1000, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 700, "VODA")
         
       ElseIf z = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1000, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 700, "SKALY")
         
       ElseIf z = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1000, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 700, "LÚKA")
         
       ElseIf z = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1000, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1100, 700, "ŽELEZO")
         EndIf
         
         
         
         ab = Math.GetRandomNumber(6)
         If ab = 1 Then
           GraphicsWindow.BrushColor = "ForestGreen"
         GraphicsWindow.FillRectangle(1200, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 700, "LES")
         
       ElseIf ab = 2 Then
         GraphicsWindow.BrushColor = "GreenYellow"
         GraphicsWindow.FillRectangle(1200, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 700, "PASTVINA")
         
       ElseIf ab = 3 Then
         GraphicsWindow.BrushColor = "Aqua"
         GraphicsWindow.FillRectangle(1200, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 700, "VODA")
         
       ElseIf ab = 4 Then
         GraphicsWindow.BrushColor = "Gainsboro"
         GraphicsWindow.FillRectangle(1200, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 700, "SKALY")
         
       ElseIf ab = 5 Then
         GraphicsWindow.BrushColor = "Goldenrod"
         GraphicsWindow.FillRectangle(1200, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 700, "LÚKA")
         
       ElseIf ab = 6 Then
         GraphicsWindow.BrushColor = "SlateGray"
         GraphicsWindow.FillRectangle(1200, 600, 200, 200)
         GraphicsWindow.BrushColor = "White"
         GraphicsWindow.FontSize = 20
         GraphicsWindow.DrawText(1300, 700, "ŽELEZO")   
     EndIf
     
     
     
       GraphicsWindow.PenColor = "Black"
       GraphicsWindow.FontSize = 10
       GraphicsWindow.DrawLine(200, 0, 200, 1500)
       GraphicsWindow.DrawLine(400, 0, 400, 1500)
       GraphicsWindow.DrawLine(600, 0, 600, 1500)
       GraphicsWindow.DrawLine(800, 0, 800, 1500)
       GraphicsWindow.DrawLine(1000, 0, 1000, 1500)
       GraphicsWindow.DrawLine(1200, 0, 1200, 1500)
       GraphicsWindow.DrawLine(1400, 0, 1400, 1500)
       
       GraphicsWindow.DrawLine(0, 0, 2000, 0)
       GraphicsWindow.DrawLine(0, 200, 2000, 200)
       GraphicsWindow.DrawLine(0, 400, 2000, 400)
       GraphicsWindow.DrawLine(0, 600, 2000, 600)
       GraphicsWindow.DrawLine(0, 800, 2000, 800)
       GraphicsWindow.DrawLine(0, 1000, 2000, 1000)
       GraphicsWindow.DrawLine(0, 1200, 2000, 1200)
       
       
       GraphicsWindow.BrushColor = "Black"
       GraphicsWindow.FillRectangle(0, 1200, 2000, 500)
       GraphicsWindow.FillRectangle(1400, 0, 20, 1500)
       GraphicsWindow.BrushColor = "White"
       GraphicsWindow.FillRectangle(1420, 0, 500, 1500)
       
       
       GraphicsWindow.FillRectangle(0, 400, 400, 400)
       GraphicsWindow.FontSize = 40
       GraphicsWindow.DrawLine(0, 400, 400, 400)
       GraphicsWindow.DrawLine(400, 400, 400, 800)
       
       tah = Controls.AddButton("SKONČIŤ ŤAH", 0, 400)
       Controls.SetSize(tah, 400, 60)
       GraphicsWindow.BrushColor = "Black"
       GraphicsWindow.FillRectangle(0, 400, 60, 400)
       GraphicsWindow.FillRectangle(340, 400, 60, 400)
       GraphicsWindow.FillRectangle(0, 400, 400, 120)
       GraphicsWindow.FillRectangle(0, 680, 400, 120)
       GraphicsWindow.BrushColor = "Gainsboro"
       GraphicsWindow.FillRectangle(60, 600, 80, 80)  
       
       
       
       
       
       
       
       GraphicsWindow.PenColor = "Black"
       GraphicsWindow.DrawLine(100, 520, 100, 600)                      '280,  160
       GraphicsWindow.DrawLine(140, 520, 140, 680)
       GraphicsWindow.DrawLine(180, 520, 180, 680)
       GraphicsWindow.DrawLine(220, 520, 220, 680)
       GraphicsWindow.DrawLine(260, 520, 260, 680)
       GraphicsWindow.DrawLine(300, 520, 300, 680)
       
          GraphicsWindow.DrawLine(0, 560, 350, 560)
          GraphicsWindow.DrawLine(0, 600, 350, 600)
           GraphicsWindow.DrawLine(140, 640, 350, 640)
          GraphicsWindow.DrawLine(140, 680, 350, 680)
          
          GraphicsWindow.BrushColor = "Brown"
          drevo = Shapes.AddRectangle(100, 25)
          Shapes.Move(drevo,830, 280)
          GraphicsWindow.BrushColor = "DimGray"
          kamen = Shapes.AddRectangle(35, 60)
          Shapes.Move(kamen, 925, 275)
       GraphicsWindow.BrushColor = "White"
       GraphicsWindow.FontSize = 20
       sekernik1 = Controls.AddButton("SEKERNÍK ", 830, 360, )
    Controls.SetSize(sekernik1, 140, 30)
    Controls.ButtonClicked = SubSekernik1
    
       EndIf
       EndSub
         
         
         
    
    Sub SubSekernik1
      GraphicsWindow.BrushColor = "Black"
      GraphicsWindow.FontSize = 15
      GraphicsWindow.DrawText( 1420, 20, "Sekerník ")
           pohyb = Controls.AddButton("POHYB", 1420, 100)
           spät = Controls.AddButton("SPÁNOK", 1420, 180)
           uzdravenie = Controls.AddButton("UZDRAVENIE", 1420, 220)
           GraphicsWindow.DrawText(1420, 250, "Zdravie: 10")
           Controls.ButtonClicked = MoznostiSekernika1
         EndSub
         
         Sub MoznostiSekernika1
          If Controls.LastClickedButton = pohyb Then   
            
             If k = 1 or k = 2 or k = 3 Or k = 4 Or k = 5 Then
               miesto1 = Controls.AddButton(" ", 700, 300)
               Controls.SetSize(miesto1, 30, 30)
             EndIf
             
             If e = 1 or e = 2 or e = 4 Or e = 5 Or e = 6 Then
                miesto2 = Controls.AddButton(" ", 900, 100)
             Controls.SetSize(miesto2, 30, 30)
             EndIf
              
             If  r = 1 or r = 2 or r = 3 or r = 4 or r = 5 Then
             miesto3 = Controls.AddButton(" ", 900, 500)
             Controls.SetSize(miesto3, 30, 30)
             EndIf
             
             If m = 1 or m = 2 or m = 4 Or m = 5 Or m = 6  Then
             miesto4 = Controls.AddButton(" ", 1100, 300)                     
             Controls.SetSize(miesto4, 30, 30)
             EndIf 
             
             Controls.ButtonClicked = Miesto
             EndIf
         EndSub
         
         Sub Miesto
           If Controls.LastClickedButton = miesto1   Then  
             Controls.HideControl(miesto1)
             Controls.HideControl(miesto2)
           Controls.HideControl(miesto3)
           Controls.HideControl(miesto4)
             Controls.Move(sekernik1, 630, 360)
           Shapes.Animate(drevo, 630, 280, 1000)
           Shapes.Animate(kamen, 725, 270, 1000)
           
         ElseIf Controls.LastClickedButton = miesto2 Then
           Controls.HideControl(miesto1)
           Controls.HideControl(miesto2)
           Controls.HideControl(miesto3)
           Controls.HideControl(miesto4)
             Controls.Move(sekernik1, 830, 160)
           Shapes.Animate(drevo, 830, 80, 1000)
           Shapes.Animate(kamen, 925, 70, 1000)
           
           ElseIf Controls.LastClickedButton = miesto3  Then
                  Controls.HideControl(miesto1)
            Controls.HideControl(miesto2)
            Controls.HideControl(miesto3)
            Controls.HideControl(miesto4)
                 Controls.Move(sekernik1, 830, 560)
           Shapes.Animate(drevo, 830, 480, 1000)
           Shapes.Animate(kamen, 925, 470, 1000) 
           
         ElseIf Controls.LastClickedButton = miesto4 Then   
                    Controls.HideControl(miesto1)
            Controls.HideControl(miesto2)
            Controls.HideControl(miesto3)
            Controls.HideControl(miesto4)
          Controls.Move(sekernik1, 1030, 360)
          Shapes.Animate(drevo, 1030, 280, 1000)
         Shapes.Animate(kamen, 1125, 270, 1000)                   
       EndIf
       
       If Controls.LastClickedButton = miesto1 Then
         
         If j = 1 Or j = 2 Or j = 4 Or  j = 5 Or  j = 6 Then
       miesto5 = Controls.AddButton(" ", 500, 300)
       Controls.SetSize(miesto5, 30, 30)
       EndIf
       
    If d = 1 Or d = 2 Or d = 4 Or  d = 5 Or  d = 6 Then
        miesto6 = Controls.AddButton(" ", 700, 100)
       Controls.SetSize(miesto6, 30, 30)
       EndIf
       
          If l = 1 Or l = 2 Or l = 3 Or  l = 4 Or  l = 5 Then
        miesto7 = Controls.AddButton(" ", 900, 300)
        Controls.SetSize(miesto7, 30, 30)
      EndIf
      
       If p = 1 Or p = 2 Or p = 4 Or  p = 5 Or  p = 6 Then
        miesto8 = Controls.AddButton(" ", 700, 500)
        Controls.SetSize(miesto8, 30, 30)
       EndIf
       
    
       Controls.ButtonClicked = Miesto_2
       EndIf
         EndSub
         
         
         Sub Miesto_2
           If Controls.LastClickedButton = miesto5   Then  
             Controls.HideControl(miesto5)
             Controls.HideControl(miesto6)
           Controls.HideControl(miesto7)
           Controls.HideControl(miesto8)
             Controls.Move(sekernik1, 430, 360)
           Shapes.Animate(drevo, 430, 280, 1000)
           Shapes.Animate(kamen, 525, 270, 1000)
           
         ElseIf Controls.LastClickedButton = miesto6 Then
           Controls.HideControl(miesto5)
           Controls.HideControl(miesto6)
           Controls.HideControl(miesto7)
           Controls.HideControl(miesto8)
             Controls.Move(sekernik1, 630, 160)
           Shapes.Animate(drevo, 630, 80, 1000)
           Shapes.Animate(kamen, 725, 70, 1000)
           
                ElseIf Controls.LastClickedButton = miesto7 Then   
                    Controls.HideControl(miesto5)
            Controls.HideControl(miesto6)
            Controls.HideControl(miesto7)
            Controls.HideControl(miesto8)
          Controls.Move(sekernik1, 830, 360)
          Shapes.Animate(drevo, 830, 280, 1000)
         Shapes.Animate(kamen, 925, 270, 1000)  
           
           
           
      ElseIf Controls.LastClickedButton = miesto8  Then
                  Controls.HideControl(miesto5)
            Controls.HideControl(miesto6)
            Controls.HideControl(miesto7)
            Controls.HideControl(miesto8)
                 Controls.Move(sekernik1, 630, 560)
           Shapes.Animate(drevo, 630, 480, 1000)
           Shapes.Animate(kamen, 725, 470, 1000) 
         EndIf
         
         
           EndSub

    Toto je celý program.
    Monday, March 26, 2018 3:30 PM
  • To analyze what your program is doing, I first tried to convert the first about 1100 lines of the Sub Clickplay. You have a lot of the same lines, so I tried to convert these to the use of loops. Those 1100 lines can be reduced to about 45 lines. By shifting the "water" cells to randomnumber=6 , 
    you can easily detect for water by checking for  variable>5 is water and variable<6 not water.
    For the logic of movement it is perhaps better to characterize each cell by x (0 to 6) and y (0 to 3). Then movement to UP is x=x-1, to RIGHT is y=y+1. 
    From these coordinates you can easily calculate the position of this cell, without "hardcoding" the coordinates 200 400 etcetera.

    After that I made the movement of the player (Sekernik1) without controlbuttonss, which makes the program much shorter. Here is the program (110 lines), which does what I think you want to do. 
    GraphicsWindow.Left=0
    GraphicsWindow.Top=0
    GraphicsWindow.Width=1600
    GraphicsWindow.Height=1000
    color="1=ForestGreen;2=GreenYellow;3=Gainsboro;4=Goldenrod;5=SlateGray;6=Aqua"
    txt="1=LES;2=PASTVINA;3=SKALY;4=LUKA;5=ZELEZO;6=VODA"
    size=200   ''of the cells
    sizeH=size/2
    GraphicsWindow.FontSize = size/10
    x0=0  '' min x
    x1=6  '' max x
    y1=3  '' max y
    
    For y=0 To y1     ''draw cells
      yp=y*size  ''number of pixels
      If y>1 Then
        x0=2
      EndIf
      For x=x0 To x1
        xp=x*size  
        a = Math.GetRandomNumber(6)
        While a=6 and y=1 and (x=3 or x=4)  ''cells K and L no water
          a = Math.GetRandomNumber(6)
        EndWhile
        GraphicsWindow.BrushColor = color[a]
        GraphicsWindow.FillRectangle(xp, yp, size, size)
        GraphicsWindow.BrushColor = "White"
        GraphicsWindow.DrawText(9+xp, yp+sizeH, txt[a])
        cell[x][y]=a
      EndFor
    EndFor
    
    For x=size To (x1+1)*size Step size   ''lines between cells
      GraphicsWindow.DrawLine(x, 0, x, 6*size)
    EndFor
    For y=0 To 6*size Step size
      GraphicsWindow.DrawLine(0, y, (x1+1)*size, y)
    EndFor
    
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FillRectangle(0,6*size,(x1+1)*size,400)   ''0, 1200, 2000, 500
    GraphicsWindow.FillRectangle((x1+1)*size, 0, 20, 7*size)
    
    GraphicsWindow.FillRectangle(0,2*size,2*size,2*size)
    GraphicsWindow.FontSize = size/5
    GraphicsWindow.DrawLine(0, 2*size, 2*size, 2*size)
    GraphicsWindow.DrawLine(2*size, 2*size, 2*size, 2*size)
    
    tah = Controls.AddButton("SKONČIŤ ŤAH", 0, 2*size)
    Controls.SetSize(tah, 2*size, 0.3*size)
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FillRectangle(0, 2*size, 2*size, 2*size)
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillRectangle(0.3*size, 2.6*size, 1.4*size, 0.8*size)
    GraphicsWindow.BrushColor = "Gainsboro"
    GraphicsWindow.FillRectangle(0.3*size, 3*size, 0.4*size,0.4*size)  
    
    GraphicsWindow.PenColor = "Black"
    y11=2.6*size
    y22=3.4*size
    GraphicsWindow.DrawLine(sizeH, y11, sizeH, 3*size)      '280,  160  vert
    For x=1 To x1  ''
      x11=sizeH+size/5*x
      GraphicsWindow.DrawLine(x11, y11, x11, y22)
    EndFor
    
    GraphicsWindow.DrawLine(0, 2.8*size, 1.75*size, 2.8*size)
    GraphicsWindow.DrawLine(0, 3*size, 1.75*size, 3*size)
    GraphicsWindow.DrawLine(0.7*size, 3.2*size, 1.75*size, 3.2*size)
    GraphicsWindow.DrawLine(0.7*size, 3.4*size, 1.75*size, 3.4*size)
    xs=4  ''starting position
    ys=1
    GraphicsWindow.BrushColor = "Brown"
    drevo = Shapes.AddRectangle(sizeH, size/8)
    Shapes.Move(drevo,4.15*size, 1.4*size)
    GraphicsWindow.BrushColor = "DimGray"
    kamen = Shapes.AddRectangle(0.175*size, 0.3*size)
    Shapes.Move(kamen, 4.6*size, 1.3*size)
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FontSize = size/10
    sekernik1 = Controls.AddButton("SEKERNÍK ", 4.15*size, 1.7*size )
    Controls.SetSize(sekernik1, 0.7*size, 0.25*size)
    Controls.ButtonClicked = SubSekernik1
    GraphicsWindow.MouseDown=MouseDn
    
    Sub SubSekernik1   ' add menu
      GraphicsWindow.BrushColor = "Black"
      GraphicsWindow.FontSize = 15
      GraphicsWindow.DrawText( 1420, 20, "Sekerník ")
      pohyb = Controls.AddButton("POHYB", 1420, 100)
      spät = Controls.AddButton("SPÁNOK", 1420, 180)
      uzdravenie = Controls.AddButton("UZDRAVENIE", 1420, 220)
      GraphicsWindow.DrawText(1420, 250, "Zdravie: 10")
    EndSub
    
    Sub MouseDn   ''  move player
      xp=GraphicsWindow.MouseX
      yp=GraphicsWindow.MouseY
      xp=Math.Floor(xp/size)
      yp=Math.Floor(yp/size) 
      If (Math.Abs(xs-xp)<2 and ys=yp) or (Math.Abs(ys-yp)<2 and xs=xp) Then  ''only one cell vertically or horizontaly
        If 0+cell[xp][yp]>0 and cell[xp][yp]<>6 Then   '' outside of playing field or water
          Shapes.Animate(drevo,(xp+0.15)*size, (yp+0.4)*size,1000)
          Shapes.Animate(kamen,(xp+0.6)*size, (yp+0.3)*size,1000)
          Shapes.Animate(sekernik1,(xp+0.15)*size,(yp+0.7)*size,1000)
          xs=xp
          ys=yp
        EndIf
      EndIf
    EndSub

    Jan [ WhTurner ] The Netherlands


    Sunday, April 1, 2018 2:38 PM
    Answerer