New to VB, looking for input
New to VB, looking for input
New to VB, looking for input
New to VB, looking for input
New to VB, looking for input
New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input
New to VB, looking for input New to VB, looking for input
New to VB, looking for input
Go Back  Xtreme Visual Basic Talk > > > New to VB, looking for input


Reply
 
Thread Tools Display Modes
  #1  
Old 06-20-2013, 11:35 PM
Michael72e Michael72e is offline
Newcomer
 
Join Date: Jun 2013
Posts: 1
Default New to VB, looking for input


So ive got some experience programming now. I've taken 2 classes, one in vb the other in Java. Neither were very good. So i am experimenting on my own. just messing around i came up with the following bit. I was hoping someone could provide input on how to make it better or ideas about what to do with it, style, things like that. Anything really. I just want to improve my coding. Basically images of heads fall down the screen and your move left and right to catch them in the image of a basket. based on GoT lol.
Code:
Public Class Form1
    Dim x1_intercept = 331
    Dim y1_intercept = 12
    Dim x2_intercept = 307
    Dim y2_intercept = 461
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short
    Dim count As Integer = 0
    Dim score As Integer = 0
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Randomize()
        y1_intercept = y1_intercept + 3
        pbx1.Location = New Point(x1_intercept, y1_intercept)

        If (GetAsyncKeyState(37)) Then
            x2_intercept = x2_intercept - 4
        End If
        If (GetAsyncKeyState(39)) Then
            x2_intercept = x2_intercept + 4
        End If

        pbx2.Location = New Point(x2_intercept, y2_intercept)

        Dim lower As Boolean
        If x1_intercept > (x2_intercept - 62) Then
            lower = True
        Else : lower = False
        End If
        Dim upper As Boolean
        If x1_intercept < (x2_intercept + 122) Then
            upper = True
        Else : upper = False
        End If
        If y1_intercept > y2_intercept - 56 And ((lower = True) And (upper = True)) Then
            RandomStart()
            head()
            score += 1
            lbl2.Text = score
        ElseIf y1_intercept > y2_intercept And ((lower = False) Or (upper = False)) Then
                MessageBox.Show("You Lost the Game of Thrones!" & vbNewLine & "Your caught " & score & " Stark heads")
                Me.Close()
        End If
    End Sub

    Private Sub RandomStart()
        Dim rand As Integer = (Int(698 - 1) * Rnd() - 1)
        x1_intercept = rand
        y1_intercept = 12
        pbx1.Location = New Point(x1_intercept, y1_intercept)
    End Sub
    Private Sub head()
        Dim i As Integer = Int(6 - 0) * Rnd() - 0
        If i = 1 Then
            pbx1.Image = Image.FromFile("arya.jpg")
        ElseIf i = 2 Then
            pbx1.Image = Image.FromFile("ned.jpg")
        ElseIf i = 3 Then
            pbx1.Image = Image.FromFile("catelyn.jpg")
        ElseIf i = 4 Then
            pbx1.Image = Image.FromFile("sansa.jpg")
        Else
            pbx1.Image = Image.FromFile("robb.jpg")

        End If
    End Sub
End Class

Last edited by passel; 06-21-2013 at 08:55 PM. Reason: added code/code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
New to VB, looking for input
New to VB, looking for input
New to VB, looking for input New to VB, looking for input
New to VB, looking for input
New to VB, looking for input
New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input New to VB, looking for input
New to VB, looking for input
New to VB, looking for input
 
New to VB, looking for input
New to VB, looking for input
 
-->