Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Dim tallinn_time As Date
- Dim stocholm_time As Date
- Dim tspeed, sspeed As Integer
- Const a = 5, b = 10, c = 15
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Const fname$ = "departure_time.txt"
- If System.IO.File.Exists(fname) = True Then
- Dim objReader As New System.IO.StreamReader(fname)
- Dim TextLine As String = ""
- Do While objReader.Peek() <> -1
- TextLine = TextLine & objReader.ReadLine() & vbNewLine
- Label4.Text = Microsoft.VisualBasic.Left(TextLine, 5)
- Dim lines() As String = IO.File.ReadAllLines("departure_time.txt")
- Label2.Text = Microsoft.VisualBasic.Left(lines(1), 5)
- Loop
- objReader.Close()
- Else
- MsgBox("File Does Not Exist")
- End If
- 'aga ta ju ei loe seda faili :( v nagu millal ja kuidas ma panen selle, et ta selle järgi hakkaks liikuma? see laev
- Timer1.Start()
- tspeed = -Int(Rnd() * (c - b + 1) + b)
- sspeed = Int(Rnd() * (b - a + 1) + a)
- 'mulle külle ei tundu, et ta randomilt oleks valinud kiirused. aga no, mingi mõte vähemalt :D
- PictureBox2.Image.RotateFlip(RotateFlipType.Rotate180FlipY)
- Label5.Visible = False
- Label6.Visible = False
- Label7.Visible = False
- Label8.Visible = False
- tallinn_time = "14:00:00 PM"
- Label4.Text = Format(tallinn_time, "HH:mm")
- stocholm_time = "13:00:00 PM"
- Label2.Text = Format(stocholm_time, "HH:mm")
- End Sub
- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
- tallinn_time = tallinn_time.AddMinutes(1)
- Label4.Text = Format(tallinn_time, "HH:mm")
- 'tegelt peaks olema üks aeg, mitte kaks, eks? või siis kahe taimeriga?
- stocholm_time = stocholm_time.AddMinutes(1)
- Label2.Text = Format(stocholm_time, "HH:mm")
- PictureBox2.Left = PictureBox2.Left + tspeed
- If (PictureBox2.Left > Me.ClientSize.Width) Then
- Timer1.Stop() 'tegelt ei saa taimer kini ju jääda, sest stocoli oma peab edasju sõitma.
- 'mik see, et kui on vasakul ja suurem siin ei tööta aga stocholi omaga, etkui on paremal ja suurem, töötab?
- Label7.Visible = True
- Label8.Visible = True
- End If
- PictureBox1.Left = PictureBox1.Left + sspeed
- If (PictureBox1.Right > Me.ClientSize.Width) Then
- Timer1.Stop()
- Label5.Visible = True
- Label6.Visible = True
- Label6.Text = Label2.Text
- MsgBox("Laevad on sadamas ilusti")
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement