00:00
00:00
kiljoy96
Just woke up, what'd I miss?

Monsieur Johnsieur @kiljoy96

Male

Challenge Pisser

Ronnie Johnald's Culinary

Pizza Planet

Joined on 7/2/08

Level:
21
Exp Points:
4,780 / 4,900
Exp Rank:
10,063
Vote Power:
6.31 votes
Rank:
Police Officer
Global Rank:
18,516
Blams:
134
Saves:
405
B/P Bonus:
10%
Whistle:
Normal
Medals:
841

I got bored.

Posted by kiljoy96 - January 30th, 2012


So I made a simple program in VB (I'm making pointless projects so I don't forget the language for next year's classes) that simulates a car starting and stopping.

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Timer1.Enabled = False Then
Timer1.Enabled = True
ElseIf Timer1.Enabled = True Then
Timer1.Enabled = False
End If
If Timer2.Enabled = False Then
Timer2.Enabled = True
Timer3.Enabled = False
ElseIf Timer2.Enabled = True Then
Timer2.Enabled = False
Timer3.Enabled = True
End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Label1.Text < 40 Then
Label1.Text = Label1.Text + 1
End If
If Label1.Text >= 40 Then
If Label1.Text < 50 Then
Label1.Text = Label1.Text + 0.8
ElseIf Label1.Text >= 50 Then
If Label1.Text < 60 Then
Label1.Text = Label1.Text + 0.6
ElseIf Label1.Text >= 60 Then
If Label1.Text < 70 Then
Label1.Text = Label1.Text + 0.4
ElseIf Label1.Text >= 70 Then
If Label1.Text < 75 Then
Label1.Text = Label1.Text + 0.2
ElseIf Label1.Text >= 75 Then
If Label1.Text < 80 Then
Label1.Text = Label1.Text + 0.1
ElseIf Label1.Text >= 80 Then
Label1.Text = Label1.Text + 0.01
End If
End If
End If
End If
End If
End If
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
PictureBox1.Top = PictureBox1.Top - Label1.Text / 4
If PictureBox1.Top < -80 Then
PictureBox1.Top = 630
End If
End Sub

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
If Label1.Text > 0 Then
Label1.Text = Label1.Text - 2
Else
Label1.Text = 0
End If
If Label1.Text = 0 Then
Timer3.Enabled = False
End If
If PictureBox1.Top < -80 Then
PictureBox1.Top = 630
End If
PictureBox1.Top = PictureBox1.Top - Label1.Text / 4
End Sub
End Class

Basically, it just increases the number of a label acting as a speedometer, which the timers then borrow from, divide the number by four, and subtract from the y value of the picture box to make it go, simulating a steady speed growth and exponential distance coverage. You just basically do the same thing inversed to make it stop smoothly.


Comments

I got bored too, that's why I read all of this

Man I have no idea what this is.