Monday, September 13, 2010

Monday, September 13 2010

I worked a little with global variables


Public pressure As Integer
Public power As Integer
Public ClaxonLoud As Integer


These were global variables for the "computer game" I am making (it isn't much of a game, really. But it helps me to put into practice things from the tutorials.


System.Console.Beep(ClaxonLoud, 200)
power += 1
score += 1

ProgressBar1.Value = pressure
If pressure < 50 Then
ClaxonLoud = 200
pressure += 2
ElseIf pressure >= 50 And pressure < 100 Then
ClaxonLoud = 300
pressure += 2
ElseIf pressure >= 100 And pressure < 150 Then
pressure += 5
ClaxonLoud = 400
ElseIf pressure >= 150 And pressure < 200 Then
pressure += 5
ClaxonLoud = 500
Else
Timer1.Enabled = False
End If


If pressure > 50 Then
EmergencyVent.Enabled = True
Else
EmergencyVent.Enabled = False
End If


Also I threw in a button and a button click event.



If power > 10 Then
pressure += -25
power += -10
Else
EmergencyVent.Enabled = False
End If


I am going to be working on some tutorials by Halvorson on functions. Michael Halvorson points out that there is a new statement offered in Visual Basic, the Return statement The return statement tells when you want to return a value and what that value is.

No comments: