- Age / Gender:
- 73, Male
- Location:
- Pizza Planet
- Joined:
- 7/2/08
- All Stats >
I should probably go to sleep now.
User Statshot
- Community Stats
-
Level 21 Musician
-
Normal Whistle
-
Ranked as Police Officer
Contact Info / Websites
Latest News
I got bored.
1/30/12 by kiljoy96
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.
Favorite Movies
Favorite Games
Favorite Audio
| CV: Zone | Industrial Song | |
| Quies | Ambient Song | |
| Sorry! | Miscellaneous Song | |
| A Twist Of Lemon In My Eye | Goth Song |
Recent Game Medals
Total Medals Earned: 588 (From 91 different games.)
Latest Movies
Latest Games
Latest Audio Submissions
| EPIC | Comedy Voice |
| Just....Slow Down | Classical Song |
| ThisOnesForNewgrounds | Drum N Bass Song |
| Some Trippy Shit | Miscellaneous Loop |