Public Slozka Public JakyB Public Pocet1 Public Pocet2 Public DoKolika Public NahX Public NahY Public Kde Public TypHry Private Sub Aktualizovat_Click() On Error GoTo p Soupiska.Path = PriCesta.Caption Soupiska.Refresh VypisHer.Clear For i = 0 To Soupiska.ListCount - 1 Soupiska.ListIndex = i VypisHer.AddItem Soupiska.FileName Next VypisHer.Text = "Výpis her -->" Exit Sub p: MsgBox ("Chybně určená složka!"): Exit Sub End Sub Private Sub CekaniNaH2_Timer() Open VytCesta.Caption + "\" + NazevHry.Text + ".nas" For Input As #1 Input #1, a1, a2, a3 Close #1 If a2 <> "" Then GoTo p Exit Sub p: CekaniNaH2.Interval = 0 cekej.Visible = False cekej.Left = 120 jme2.Caption = a2 Open Slozka + "a" For Output As #1 Write #1, Str(h1.Left), Str(h1.Top) Close #1 Open Slozka + "b" For Output As #1 Write #1, Str(h2.Left), Str(h2.Top) Close #1 odpocet.Interval = 1000 End Sub Private Sub fil_KeyDown(KeyCode As Integer, Shift As Integer) If vytvor.Visible = True Or pripoj.Visible = True Then Exit Sub If pocty.Visible = True Then Exit Sub Select Case KeyCode Case vbKeyDown: If h1.Top < mriz.Height + mriz.Top - 456 Then h1.Top = h1.Top + 456 Case vbKeyUp: If h1.Top > mriz.Top Then h1.Top = h1.Top - 456 Case vbKeyLeft: If h1.Left > mriz.Left Then h1.Left = h1.Left - 456 Case vbKeyRight: If h1.Left < mriz.Width + mriz.Left - 456 Then h1.Left = h1.Left + 456 If h1.Left = b1.Left And h1.Top = b1.Top Then Pocet1 = Pocet1 + 1: GoTo l If h1.Left = b2.Left And h1.Top = b2.Top Then Pocet1 = Pocet1 + 1: GoTo p body1.Caption = Pocet1: body2.Caption = Pocet2 If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 Exit Sub l: Nahodna If Hlavni.PlayMode = 0 Then seber.Play If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 b1.Left = NahX: b1.Top = NahY: Exit Sub p: Nahodna If Hlavni.PlayMode = 0 Then seber.Play If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 b2.Left = NahX: b2.Top = NahY End Select End Sub Public Sub Image1_Click() Zavri.Left = (Hlavni.Width - Zavri.Width) \ 2 Zavri.Top = (Hlavni.Height - Zavri.Height) \ 2 Hlavni.mmp.Play: Zavri.Visible = True End Sub Private Sub Label5_Click() mriz.Height = 2172 Zavri.Visible = False Zavri.Left = -10000 vytvor.Visible = False: pripoj.Visible = False SitPl.WindowState = 0 SitPl.Hide End Sub Private Sub lll_Click(Index As Integer) If Hlavni.PlayMode = 0 Then Hlavni.mmp.Play If Index = 1 Then Druhej.Interval = 0: mriz.Left = -10000: mriz.Height = 2172: vytvor.Visible = False: pripoj.Visible = False: SitPl.WindowState = 0: SitPl.Hide If Index = 2 Then Zavri.Visible = False End Sub Private Sub lll_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = JakyB Then Exit Sub lll(1).ForeColor = &HFF& lll(2).ForeColor = &HFF& lll(Index).ForeColor = &HFFFFFF JakyB = Index If Hlavni.PlayMode = 0 Then Hlavni.mp.CurrentPosition = 0: Hlavni.mp.Play End Sub Private Sub Nastav_Timer() cekej.Visible = True If Kde = 0 Then Kde = 1: Nastav.Interval = 1000: Nastaveni.tim.Interval = 1: Exit Sub If Kde = 1 Then Kde = 0: Nastav.Interval = 0 Zavri.Visible = False Zavri.Left = -10000 If TypHry = 0 Then vytvor.Left = (Hlavni.Width - vytvor.Width) \ 2 If TypHry = 0 Then vytvor.Top = (Hlavni.Height - vytvor.Height) \ 2 If TypHry = 1 Then pripoj.Left = (Hlavni.Width - pripoj.Width) \ 2 If TypHry = 1 Then pripoj.Top = (Hlavni.Height - pripoj.Height) \ 2 SitPl.MouseIcon = Hlavni.MouseIcon: SitPl.MousePointer = 99 jme1.ForeColor = Nastaveni.s(0).BackColor jme2.ForeColor = Nastaveni.s(1).BackColor h1.BackColor = jme1.ForeColor h2.BackColor = jme2.ForeColor b1.BackColor = Nastaveni.s(2).BackColor b2.BackColor = b1.BackColor mriz.Width = Hlavni.Width - 240 - 240 a = mriz.Width \ 456 mriz.Width = a * 456 mriz.Height = Hlavni.Height - 600 - 240 a = mriz.Height \ 456 mriz.Height = a * 456 mriz.Left = (Hlavni.Width - mriz.Width) \ 2 SitPl.WindowState = 2 cekej.Left = (Hlavni.Width - cekej.Width) \ 2 Pocet1 = 0: Pocet2 = 0: body1.Caption = Pocet1: body2.Caption = Pocet2 Image1.Left = mriz.Left + mriz.Width - Image1.Width mriz.Refresh: JakyB = -1: pocty.Caption = 3 If Hlavni.PlayMode = 0 Then seber2.FileName = App.Path + "\soubory\zvseb.viv": seber2.Stop If Nastaveni.zv.Value = 0 Then seber2.Mute = True Else seber2.Mute = False If Hlavni.PlayMode = 0 Then victory2.FileName = App.Path + "\soubory\zvvi.viv": victory2.Stop If Nastaveni.zv.Value = 0 Then victory2.Mute = True Else victory2.Mute = False If TypHry = 0 Then VytvorJmeno.Text = Nastaveni.t1.Text NazevHry.Text = "Sbirani" PocetBodu.Text = Nastaveni.t3.Text VytCesta.Caption = Nastaveni.cesta.Text End If If TypHry = 1 Then PripojJmeno.Text = Nastaveni.t1.Text PriCesta.Caption = Nastaveni.cesta.Text Aktualizovat_Click End If End Sub Public Sub Nahodna() Randomize Timer a = mriz.Width \ 456 a2 = Int(Rnd * a) NahX = a2 * 456 + mriz.Left b = mriz.Height \ 456 c = Int(Rnd * b) NahY = c * 456 + mriz.Top End Sub Public Sub Vitez(jaky) body1.Caption = Pocet1: body2.Caption = Pocet2 victory.Play fil.Enabled = False pocitac.Interval = 0 Frame1.Visible = True Frame1.Left = (Hlavni.Width - Frame1.Width) \ 2 Frame1.Top = (Hlavni.Height - Frame1.Height) \ 2 If jaky = 1 Then viz.Caption = "Vítězí hráč " + jme1.Caption: viz.ForeColor = h1.BackColor If jaky = 2 Then viz.Caption = "Vítězí hráč " + jme2.Caption: viz.ForeColor = h2.BackColor End Sub Private Sub odpocet_Timer() pocty.Visible = True pocty.Caption = pocty.Caption - 1 If pocty.Caption < 1 Then odpocet.Interval = 0 pocty.Visible = False fil.Enabled = True: fil.SetFocus Druhej.Interval = 1 End If End Sub Private Sub PripojHru_Click() On Error GoTo p Open PriCesta.Caption + "\" + PriNazev.Caption For Input As #1 Input #1, a1, a2, a3 Close #1 jme1.Caption = PripojJmeno.Text jme2.Caption = a1 DoKolika = Val(a3) pripoj.Visible = False cekej.Visible = False cekej.Left = 120 Open PriCesta.Caption + "\" + PriNazev.Caption For Output As #1 Write #1, a1, jme1.Caption, a3 Close #1 Slozka = PriCesta.Caption + "\" + PriNazev.Caption Slozka = Left(Slozka, Len(Slozka) - 1) h2.Left = 3 * 456 + mriz.Left h2.Top = 3 * 456 + mriz.Top h1.Left = 3 * 456 + mriz.Left h1.Top = 5 * 456 + mriz.Top odpocet.Interval = 1000 Exit Sub p: MsgBox ("Nelze připojit!") End Sub Private Sub PriZmen_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then PriZmen.Visible = False: PriCesta.Caption = PriZmen.Text: PriCesta.Visible = True End Sub Private Sub PriZmenit_Click() PriZmen.Visible = True: PriCesta.Visible = False PriZmen.Text = PriCesta.Caption End Sub Private Sub VypisHer_Click() PriNazev.Caption = VypisHer.Text End Sub Private Sub VytvorHru_Click() On Error GoTo p If Right(VytCesta.Caption, 1) = "\" Or Right(VytCesta.Caption, 1) = "/" Then VytCesta.Caption = Left(VytCesta.Caption, Len(VytCesta.Caption) - 1) Open VytCesta.Caption + "\" + NazevHry.Text + ".nas" For Output As #1 Write #1, VytvorJmeno.Text, "", PocetBodu.Text Close #1 jme1.Caption = VytvorJmeno.Text DoKolika = Val(PocetBodu.Text) vytvor.Visible = False Slozka = VytCesta.Caption + "\" + NazevHry.Text + ".nas" Slozka = Left(Slozka, Len(Slozka) - 1) CekaniNaH2.Interval = 100 h1.Left = 3 * 456 + mriz.Left h1.Top = 3 * 456 + mriz.Top h2.Left = 3 * 456 + mriz.Left h2.Top = 5 * 456 + mriz.Top Exit Sub p: MsgBox ("Hra nejde vytvořit!") End Sub Private Sub VytZmen_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then VytZmen.Visible = False: VytCesta.Caption = VytZmen.Text: VytCesta.Visible = True End Sub Private Sub VytZmenit_Click() VytZmen.Visible = True: VytCesta.Visible = False VytZmen.Text = VytCesta.Caption End Sub Private Sub zp1_Click(Index As Integer) Image1_Click End Sub Dim Jaky1 Public Sub l_Click(Index As Integer) If Hlavni.PlayMode = 0 Then Hlavni.mmp.Play SitPl.Height = 3264 If Index = 0 Then SitPl.TypHry = 0: SitPl.vytvor.Visible = True: SitPl.Nastav.Interval = 1: SitPl.Show 1 If Index = 1 Then SitPl.TypHry = 1: SitPl.pripoj.Visible = True: SitPl.Nastav.Interval = 1: SitPl.Show 1 If Index = 2 Then MenuSit.Hide End Sub Public Sub l_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Jaky1 = Index Then Exit Sub For i = 0 To 2 l(i).ForeColor = &HFF&: Next l(Index).ForeColor = &HFFFFFF If Hlavni.PlayMode = 1 Then GoTo l Hlavni.mp.CurrentPosition = 0 Hlavni.mp.Play l: Jaky1 = Index End Sub Dim Jaky0 Public Sub l_Click(Index As Integer) If Hlavni.PlayMode = 0 Then Hlavni.mmp.Play Select Case Index Case 0: SinglePl.TypHry = 0: SinglePl.Nastav.Interval = 1: SinglePl.Show 1 Case 1: SinglePl.TypHry = 1: SinglePl.Nastav.Interval = 1: SinglePl.Show 1 Case 2: MenuSingle.Hide End Select End Sub Public Sub l_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Jaky0 = Index Then Exit Sub For i = 0 To 2 l(i).ForeColor = &HFF&: Next l(Index).ForeColor = &HFFFFFF If Hlavni.PlayMode = 1 Then GoTo l Hlavni.mp.CurrentPosition = 0 Hlavni.mp.Play l: Jaky0 = Index End Sub Dim Jaky4 Public ces Dim sColor As SelectedColor Private Sub c_Click(Index As Integer) If Hlavni.PlayMode = 0 Then Hlavni.mmp.Play ColorDialog.rgbResult = s(Index).BackColor sColor = ShowColor(Me.hwnd) If sColor.bCanceled Then Exit Sub s(Index).BackColor = sColor.oSelectedColor End Sub Private Sub Uloz() level.Text = Val(level.Text) If Val(level.Text) > 10 Or Val(level.Text) < 1 Then MsgBox ("Chybné zadání levelu!"): Exit Sub If Val(t3.Text) > 99 Or Val(t3.Text) < 1 Then MsgBox ("Chybné zadání počtu bodů!"): Exit Sub On Error GoTo q Open App.Path + "\setdata" For Output As #1 Write #1, s(0).BackColor, s(1).BackColor, s(2).BackColor, t1.Text, t2.Text, t3.Text, ces, level.Text, cesta.Text, Str(zv.Value) Close #1 Nastaveni.Hide Exit Sub q: MsgBox ("Chyba při zápisu!") End Sub Private Sub ll_Click(Index As Integer) If Index = 1 Then Uloz If Index = 2 Then Nastaveni.Hide If Hlavni.PlayMode = 0 Then Hlavni.mmp.Play End Sub Private Sub ll_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Jaky4 = Index Then Exit Sub For i = 1 To 2 ll(i).ForeColor = &HC0FFFF: Next ll(Index).ForeColor = &HFFFF& If Hlavni.PlayMode = 1 Then GoTo l Hlavni.mp.CurrentPosition = 0 Hlavni.mp.Play l: Jaky4 = Index End Sub Private Sub T3_Change() On Error GoTo p If t3.Text > 25 Or t3.Text < 1 Then t3.Text = 16 p: End Sub Private Sub tim_timer() Nastaveni.Left = Hlavni.f.Left - Nastaveni.Width - 200 Nastaveni.Top = Hlavni.f.Top tim.Interval = 0 On Error GoTo p Open App.Path + "\setdata" For Input As #1 Input #1, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10 Close #1 s(0).BackColor = b1 s(1).BackColor = b2 s(2).BackColor = b3 t1.Text = b4 t2.Text = b5 t3.Text = b6 ces = b7 level.Text = b8 cesta.Text = b9 zv.Value = Val(b10) If Hlavni.PlayMode = 1 And zv.Value = 1 Then MsgBox ("Zvuky nelze načíst. Vypněte přehrávač.") p: End Sub Private Sub zv_Click() If zv.Value = 0 Then Hlavni.mp.Mute = True Hlavni.mmp.Mute = True zv.Caption = "VYP" End If If zv.Value = 1 Then zv.Caption = "ZAP" Hlavni.mp.Mute = False Hlavni.mmp.Mute = False End If End Sub Dim Jaky2 Private Sub Form_Load() Jaky2 = -1 End Sub Private Sub ll_Click(Index As Integer) If Hlavni.PlayMode = 0 Then Hlavni.mmp.Play If Index = 0 Then l.Text = "Tuto hru vytvořil Jan Dvořák" + Chr(13) + Chr(10) + "Cílem této hry je získat větší počet bodů než protihráč" + Chr(13) + Chr(10) + " " + Chr(13) + Chr(10) + "E-mail: dvorkaman@centrum.cz" If Index = 1 Then l.Text = "Single: " + Chr(13) + Chr(10) + "Čtverečky se ovládají pomocí šipek (hráč 1) a pomocí kláces S F E D (hráč 2) " + Chr(13) + Chr(10) + "Po síti: " + Chr(13) + Chr(10) + "Oba hráči používají na svých klávesnicích šipky" If Index = 2 Then Napoveda.Hide If Hlavni.PlayMode = 0 Then Hlavni.mp.CurrentPosition = 0: Hlavni.mp.Play End Sub Private Sub ll_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Jaky2 = Index Then Exit Sub For i = 0 To 2 ll(i).ForeColor = &HC0FFFF: Next ll(Index).ForeColor = &HFFFF& If Hlavni.PlayMode = 1 Then GoTo l Hlavni.mp.CurrentPosition = 0 Hlavni.mp.Play l: Jaky2 = Index End Sub Public PlayMode Public Kurzor Dim JakyA Dim jaky Dim a As Boolean Dim t(4) Private Sub Form_Load() Randomize Timer Kurzor = 1 On Error GoTo p mp.FileName = App.Path + "\Soubory\zvmyov.viv": mp.Stop mmp.FileName = App.Path + "\Soubory\zvmycl.viv": mmp.Stop mp.Play: mp.Stop l: Nastaveni.tim.Interval = 1 Exit Sub p: PlayMode = 1 GoTo l End Sub Public Sub l_Click(Index As Integer) If koncim.Visible = True Then Exit Sub If PlayMode = 0 Then mmp.Play If Index = 0 Or Index = 0 Then If PlayMode = 0 Then mp.Play Select Case Index Case 0: MenuSingle.Left = (Hlavni.Width - MenuSingle.Width) \ 2: MenuSingle.Top = f.Top + 220: mp.CurrentPosition = 0: MenuSingle.Show 1 Case 1: MenuSit.Left = (Hlavni.Width - MenuSit.Width) \ 2: MenuSit.Top = f.Top + 220: mp.CurrentPosition = 0: MenuSit.Show 1 Case 2: Napoveda.Left = f.Left + f.Width + 200: Napoveda.Top = f.Top: Napoveda.Show 1 Case 3: Nastaveni.tim.Interval = 1: Nastaveni.Show 1 Case 4: koncim.Left = (Hlavni.Width - koncim.Width) \ 2: koncim.Top = (Hlavni.Height - koncim.Height) \ 2: koncim.Visible = True: If PlayMode = 0 Then mp.Play End Select End Sub Public Sub l_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If koncim.Visible = True Then Exit Sub If Index = jaky Then Exit Sub For i = 0 To 4 l(i).ForeColor = &HFF&: Next l(Index).ForeColor = &HFFFFFF t2.Caption = t(Index) If PlayMode = 1 Then GoTo l mp.CurrentPosition = 0 mp.Play l: jaky = Index End Sub Public Sub lll_Click(Index As Integer) If PlayMode = 0 Then mmp.Play If Index = 1 Then Unload MenuSingle Unload MenuSit Unload Napoveda Unload Nastaveni Unload Hlavni End End If If Index = 2 Then Kurzor = 5: koncim.Visible = False: lll_MouseMove 1, 0, 0, 0, 0 End Sub Public Sub lll_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = JakyA Then Exit Sub lll(1).ForeColor = &HFF& lll(2).ForeColor = &HFF& lll(Index).ForeColor = &HFFFFFF JakyA = Index If PlayMode = 0 Then mp.CurrentPosition = 0: mp.Play End Sub Private Sub seto_Timer() seto.Interval = 0 f.Left = Hlavni.Width \ 2 - f.Width \ 2 f.Top = Hlavni.Height \ 2 - f.Height \ 2 t(0) = "Tato volba je pro dva hráče hrající na stejném počítači nebo pro jednoho hráče bojujícího proti počítači" t(1) = "Tato volba je pro dva hráče, kteří hrají na dvou počítačích pomocí sítě" t(3) = "Zde si můžete nastavit plno užitečných věcí" t(2) = "Kliknutím zobrazíte nápovědu programu" t(4) = "Ukončení hry Sbírání Bodů SE" t2.Caption = t(0) t2.Left = (Hlavni.Width - t2.Width) \ 2 t2.Top = f.Top + f.Height + 300 Label2.Top = Hlavni.Height - 300 Image2.Left = (Hlavni.Width - Image2.Width) \ 2 Image1.Left = (Hlavni.Width - Image1.Width) \ 2 End Sub Public GetInt Public JakyB Public Pocet1 Public Pocet2 Public NahX Public NahY Public LevelH Public Kde Public TypHry Private Sub fil_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyDown: If h1.Top >= mriz.Height + mriz.Top - 456 Then Exit Sub Else h1.Top = h1.Top + 456 Case vbKeyUp: If h1.Top <= mriz.Top Then Exit Sub Else h1.Top = h1.Top - 456 Case vbKeyLeft: If h1.Left <= mriz.Left Then Exit Sub Else h1.Left = h1.Left - 456 Case vbKeyRight: If h1.Left >= mriz.Width + mriz.Left - 456 Then Exit Sub Else h1.Left = h1.Left + 456 If TypHry = 1 Then GoTo pok Case vbKeyS: If h2.Left <= mriz.Left Then Exit Sub Else h2.Left = h2.Left - 456 Case vbKeyF: If h2.Left >= mriz.Width + mriz.Left - 456 Then Exit Sub Else h2.Left = h2.Left + 456 Case vbKeyE: If h2.Top <= mriz.Top Then Exit Sub Else h2.Top = h2.Top - 456 Case vbKeyD: If h2.Top >= mriz.Height + mriz.Top - 456 Then Exit Sub Else h2.Top = h2.Top + 456 End Select pok: If h1.Left = b1.Left And h1.Top = b1.Top Then Pocet1 = Pocet1 + 1: GoTo l If h1.Left = b2.Left And h1.Top = b2.Top Then Pocet1 = Pocet1 + 1: GoTo p If TypHry = 1 Then GoTo pok2 If h2.Left = b1.Left And h2.Top = b1.Top Then Pocet2 = Pocet2 + 1: GoTo l If h2.Left = b2.Left And h2.Top = b2.Top Then Pocet2 = Pocet2 + 1: GoTo p pok2: If Len(fil.Text) > 100 Then fil.Text = "" body1.Caption = Pocet1: body2.Caption = Pocet2 If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 Exit Sub l: Nahodna If Hlavni.PlayMode = 0 Then seber.Play If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 b1.Left = NahX: b1.Top = NahY: Exit Sub p: Nahodna If Hlavni.PlayMode = 0 Then seber.Play If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 b2.Left = NahX: b2.Top = NahY End Sub Private Sub Image1_Click() GetInt = pocitac.Interval: pocitac.Interval = 0 Zavri.Left = (Hlavni.Width - Zavri.Width) \ 2 Zavri.Top = (Hlavni.Height - Zavri.Height) \ 2 Hlavni.mmp.Play: Zavri.Visible = True End Sub Private Sub Label5_Click() mriz.Height = 2172 Zavri.Left = -10000 Frame1.Left = -10000 SinglePl.WindowState = 0 SinglePl.Hide End Sub Private Sub lll_Click(Index As Integer) If Hlavni.PlayMode = 0 Then Hlavni.mmp.Play If Index = 1 Then Zavri.Left = -10000: mriz.Height = 2172: pocitac.Interval = 0: SinglePl.WindowState = 0: Frame1.Left = -10000: SinglePl.Hide If Index = 2 Then pocitac.Interval = GetInt: Zavri.Visible = False End Sub Private Sub lll_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = JakyB Then Exit Sub lll(1).ForeColor = &HFF& lll(2).ForeColor = &HFF& lll(Index).ForeColor = &HFFFFFF JakyB = Index If Hlavni.PlayMode = 0 Then Hlavni.mp.CurrentPosition = 0: Hlavni.mp.Play End Sub Private Sub Nastav_Timer() cekej.Visible = True If Kde = 0 Then Kde = 1: Nastav.Interval = 1000: Nastaveni.tim.Interval = 1: Exit Sub If Kde = 1 Then Kde = 0: Nastav.Interval = 0 SinglePl.MouseIcon = Hlavni.MouseIcon: SinglePl.MousePointer = 99 Zavri.Visible = False Zavri.Left = -10000 jme1.Caption = Nastaveni.t1.Text jme2.Caption = Nastaveni.t2.Text jme1.ForeColor = Nastaveni.s(0).BackColor jme2.ForeColor = Nastaveni.s(1).BackColor If TypHry = 1 Then jme2.Caption = "Počítač" h1.BackColor = jme1.ForeColor h2.BackColor = jme2.ForeColor b1.BackColor = Nastaveni.s(2).BackColor b2.BackColor = b1.BackColor mriz.Width = Hlavni.Width - 240 - 240 a = mriz.Width \ 456 mriz.Width = a * 456 mriz.Height = Hlavni.Height - 600 - 240 a = mriz.Height \ 456 mriz.Height = a * 456 mriz.Left = (Hlavni.Width - mriz.Width) \ 2 SinglePl.WindowState = 2 cekej.Left = (Hlavni.Width - cekej.Width) \ 2 Nahodna h1.Left = NahX: h1.Top = NahY Nahodna h2.Left = NahX: h2.Top = NahY Nahodna b1.Left = NahX: b1.Top = NahY Nahodna b2.Left = NahX: b2.Top = NahY Pocet1 = 0: Pocet2 = 0: body1.Caption = Pocet1: body2.Caption = Pocet2 Image1.Left = mriz.Left + mriz.Width - Image1.Width fil.Enabled = True fil.SetFocus mriz.Refresh: JakyB = -1 If Hlavni.PlayMode = 0 Then seber.FileName = App.Path + "\soubory\zvseb.viv": seber.Stop If Nastaveni.zv.Value = 0 Then seber.Mute = True Else seber.Mute = False If Hlavni.PlayMode = 0 Then victory.FileName = App.Path + "\soubory\zvvi.viv": victory.Stop If Nastaveni.zv.Value = 0 Then victory.Mute = True Else victory.Mute = False If TypHry = 1 Then l: a = InputBox("Zadejte úroveň rychlosti počítače (1 - 10):", , Nastaveni.level.Text) If a = "" Then a = Val(Nastaveni.level.Text) If Val(a) < 1 Or Val(a) > 10 Then MsgBox ("Chybné zadání!"): GoTo l LevelH = Val(a) pocitac.Interval = 50 * (10 - Val(LevelH)) End If cekej.Visible = False cekej.Left = 120 End Sub Public Sub Nahodna() Randomize Timer a = mriz.Width \ 456 a2 = Int(Rnd * a) NahX = a2 * 456 + mriz.Left b = mriz.Height \ 456 c = Int(Rnd * b) NahY = c * 456 + mriz.Top End Sub Public Sub Vitez(jaky) body1.Caption = Pocet1: body2.Caption = Pocet2 victory.Play fil.Enabled = False pocitac.Interval = 0 Frame1.Visible = True Frame1.Left = (Hlavni.Width - Frame1.Width) \ 2 Frame1.Top = (Hlavni.Height - Frame1.Height) \ 2 If jaky = 1 Then viz.Caption = "Vítězí hráč " + jme1.Caption: viz.ForeColor = h1.BackColor If jaky = 2 Then viz.Caption = "Vítězí hráč " + jme2.Caption: viz.ForeColor = h2.BackColor End Sub Private Sub pocitac_Timer() a = Abs(h2.Left - b1.Left) b = Abs(h2.Top - b1.Top) c = Abs(h2.Left - b2.Left) d = Abs(h2.Top - b2.Top) If a + b <= c + d Then jdi = 1 Else jdi = 2 If jdi = 1 Then If h2.Left > b1.Left Then h2.Left = h2.Left - 456 If h2.Left < b1.Left Then h2.Left = h2.Left + 456 If h2.Top > b1.Top Then h2.Top = h2.Top - 456 If h2.Top < b1.Top Then h2.Top = h2.Top + 456 End If If jdi = 2 Then If h2.Left > b2.Left Then h2.Left = h2.Left - 456 If h2.Left < b2.Left Then h2.Left = h2.Left + 456 If h2.Top > b2.Top Then h2.Top = h2.Top - 456 If h2.Top < b2.Top Then h2.Top = h2.Top + 456 End If If h2.Left = b1.Left And h2.Top = b1.Top Then Pocet2 = Pocet2 + 1: GoTo l If h2.Left = b2.Left And h2.Top = b2.Top Then Pocet2 = Pocet2 + 1: GoTo p Exit Sub l: Nahodna If Hlavni.PlayMode = 0 Then seber.Play If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 body2.Caption = Pocet2 b1.Left = NahX: b1.Top = NahY: Exit Sub p: Nahodna If Hlavni.PlayMode = 0 Then seber.Play If Pocet1 = Val(Nastaveni.t3.Text) Then Vitez 1 If Pocet2 = Val(Nastaveni.t3.Text) Then Vitez 2 b2.Left = NahX: b2.Top = NahY body2.Caption = Pocet2 End Sub