Here's the Code I used:
Public Class Form1 Dim f_keyval As Integer Dim beat, f_time1(), f_time2(), f_time3(), f_CurSeconds(), f_NewInterval(), f_CurBeat As Integer Dim f_direction() As String Dim f_score As Integer Dim f_minsec, f_sec, f_min As Integer Dim loc As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load loc = ("\Computer Programming\gif check\gif check\Resources\kick(1).gif")[color="#006400"]'picture the Megaman hits[/color] Me.PictureBox2.Image = Image.FromFile(loc) FileOpen(1, "piano(loud)red-lucifer.txt", OpenMode.Input, OpenAccess.Read)[color="#006400"]'sequential file that is read[/color] Do Until EOF(1) ReDim Preserve f_time1(beat)[color="#006400"]'mins, sec, milisec (f_time1-f_time3) in that order[/color] ReDim Preserve f_time2(beat) ReDim Preserve f_time3(beat) ReDim Preserve f_direction(beat) [color="#006400"]'what picture will be moving[/color] ReDim Preserve f_CurSeconds(beat)[color="#006400"]'current seconds that have passed [/color] ReDim Preserve f_NewInterval(beat)[color="#006400"]'when the next interval should begin[/color] Input(1, f_time1(beat)) Input(1, f_time2(beat)) Input(1, f_time3(beat)) Input(1, f_direction(beat)) beat += 1 Loop beat -= 1 For Seconds = 0 To beat [color="#006400"]'I have it so that the time is read to the certain time. So if I say that the time in the file is 00,01,000,U then the Megaman head will move at 1sec[/color] f_time1(Seconds) += 1 If f_time1(Seconds) = 100 Then f_time1(Seconds) = 0 f_time2(Seconds) += 1 End If If f_time2(Seconds) = 60 Then f_time2(Seconds) = 0 f_time3(Seconds) += 1 End If f_CurSeconds(Seconds) = (f_time1(Seconds) * 60) + f_time2(Seconds) + (f_time3(Seconds) * 100) Next For a = 1 To beat If a = 1 Then f_CurSeconds(a) = f_CurSeconds(a) * 100 End If f_CurSeconds(a) = f_CurSeconds(a - 1)[color="#006400"]'makes it so that the time is simply added onto the next[/color] Next For i = 0 To beat f_NewInterval(i) = (f_CurSeconds(i) * 100) / 5[color="#006400"]'represents when the next interval should be[/color] Next f_CurBeat = 0 timTime.Enabled = True timBeat.Enabled = True FileClose(1) End Sub [color="#006400"]'timer code[/color] Private Sub timTime_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timTime.Tick For v = 0 To beat If f_direction(v) = "U" Then[color="#006400"]'the declaration of what pic should move[/color] Megarmans.Top += v[color="#006400"]'Megaman head moves at the speed of beat[/color] If Megarmans.Bounds.IntersectsWith(PictureBox2.Bounds) Then Megarmans.Top = 5 f_CurBeat += 1 timTime.Interval = f_NewInterval(v) [color="#006400"]'the Megaman head is reset to the top of the form at 5. Then the next time should be read. And then the cycle changes according to the next time.[/color] End If End If Next End Sub End Class
This piece of code is the one that when the second time comes around the picture just inches forward and does not intersect with the other picture in time. I have a timer running at the side to see that the first time does intersect with the picture on time, but is everything thing else that does not.
Also I think that the way I have my text file written out, might also have something to do with it. Here is an examlpe:
min, sec, milisec, picture
00, 01, 000, U
00, 05, 000, U
00, 10, 000, U
I greatly appreciate any help that I can get. I really do want to get this code to work. Thank you.
This post has been edited by stayscrisp: 04 January 2011 - 09:28 AM
Reason for edit:: Added code tags