kiljoy96's Banner

kiljoy96

Reviews Favorites Audio Flash News Main
kiljoy96

Age/Gender: 73, Male
Location: Pizza Planet
Job: Challenge Pisser

I should probably go to sleep now.

Newgrounds Stats

Sign-Up Date:
7/2/08

Level: 21
Aura: Dark

Rank: Police Officer
Blams: 133
Saves: 400
Rank #: 17,610

Whistle Status: Normal

Exp. Points: 4,440 / 4,900
Exp. Rank #: 6,378
Voting Pow.: 6.24 votes

BBS Posts: 3,525 (2.69 per day)
Flash Reviews: 193
Music Reviews: 26
Trophies: 0

Latest News

kiljoy96

I got bored.

Posted by kiljoy96 Jan. 30, 2012 @ 6:54 PM EST

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.

All News Posts 1 comment | Log in to comment! | Share this!