Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. Public Class Form1
  2.  
  3. Dim tallinn_time As Date
  4. Dim stocholm_time As Date
  5. Dim tspeed, sspeed As Integer
  6. Const a = 5, b = 10, c = 15
  7.  
  8. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  9.  
  10. Const fname$ = "departure_time.txt"
  11. If System.IO.File.Exists(fname) = True Then
  12. Dim objReader As New System.IO.StreamReader(fname)
  13.  
  14. Dim TextLine As String = ""
  15. Do While objReader.Peek() <> -1
  16. TextLine = TextLine & objReader.ReadLine() & vbNewLine
  17. Label4.Text = Microsoft.VisualBasic.Left(TextLine, 5)
  18.  
  19. Dim lines() As String = IO.File.ReadAllLines("departure_time.txt")
  20. Label2.Text = Microsoft.VisualBasic.Left(lines(1), 5)
  21. Loop
  22.  
  23. objReader.Close()
  24. Else
  25. MsgBox("File Does Not Exist")
  26. End If
  27. 'aga ta ju ei loe seda faili :( v nagu millal ja kuidas ma panen selle, et ta selle järgi hakkaks liikuma? see laev
  28.  
  29.  
  30. Timer1.Start()
  31.  
  32. tspeed = -Int(Rnd() * (c - b + 1) + b)
  33. sspeed = Int(Rnd() * (b - a + 1) + a)
  34. 'mulle külle ei tundu, et ta randomilt oleks valinud kiirused. aga no, mingi mõte vähemalt :D
  35.  
  36. PictureBox2.Image.RotateFlip(RotateFlipType.Rotate180FlipY)
  37. Label5.Visible = False
  38. Label6.Visible = False
  39. Label7.Visible = False
  40. Label8.Visible = False
  41.  
  42. tallinn_time = "14:00:00 PM"
  43. Label4.Text = Format(tallinn_time, "HH:mm")
  44. stocholm_time = "13:00:00 PM"
  45. Label2.Text = Format(stocholm_time, "HH:mm")
  46.  
  47.  
  48.  
  49.  
  50. End Sub
  51.  
  52. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  53.  
  54. tallinn_time = tallinn_time.AddMinutes(1)
  55. Label4.Text = Format(tallinn_time, "HH:mm")
  56. 'tegelt peaks olema üks aeg, mitte kaks, eks? või siis kahe taimeriga?
  57. stocholm_time = stocholm_time.AddMinutes(1)
  58. Label2.Text = Format(stocholm_time, "HH:mm")
  59.  
  60. PictureBox2.Left = PictureBox2.Left + tspeed
  61. If (PictureBox2.Left > Me.ClientSize.Width) Then
  62. Timer1.Stop() 'tegelt ei saa taimer kini ju jääda, sest stocoli oma peab edasju sõitma.
  63. 'mik see, et kui on vasakul ja suurem siin ei tööta aga stocholi omaga, etkui on paremal ja suurem, töötab?
  64. Label7.Visible = True
  65. Label8.Visible = True
  66. End If
  67.  
  68. PictureBox1.Left = PictureBox1.Left + sspeed
  69. If (PictureBox1.Right > Me.ClientSize.Width) Then
  70. Timer1.Stop()
  71. Label5.Visible = True
  72. Label6.Visible = True
  73. Label6.Text = Label2.Text
  74.  
  75. MsgBox("Laevad on sadamas ilusti")
  76.  
  77. End If
  78.  
  79. End Sub
  80. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement