Welcome to Dream.In.Code
Getting Help is Easy!

Join 118,310 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,686 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Visual basic Guitar Hero

 
Reply to this topicStart new topic

Visual basic Guitar Hero

citricube
post 6 May, 2008 - 01:27 PM
Post #1


New D.I.C Head

*
Joined: 21 Jan, 2008
Posts: 24

I am Making a cheesy Guitar Hero like program and wanted to make a simple method to make a new note here is my code so far it only makes one note move and then the rest made with makeR() stay in place b/c their timer doesn't control them

CODE


Public Class Form1
    Dim x
    Dim r(9999) As PictureBox
    Dim track(9999) As Integer
    Dim Timer(9999) As Timer
    Dim wow = ""
    Public Event Tick As EventHandler

    Private Sub TimerEventProcessor(ByVal myObject As Object, _
                                          ByVal myEventArgs As EventArgs)
        r(track(x)).Top = r(track(x)).Top - 1
    End Sub
    Private Function makeR()
        If x = 9999 Or wow = "wow" Then
            x = x - 1
            r(x) = New PictureBox
            r(x).Image = My.Resources.n1
            r(x).Visible = True
            r(x).Top = 278
            r(x).Width = 25
            r(x).Height = 25
            r(x).Left = 12
            r(x).BringToFront()
            Controls.Add(r(x))
            track(x) = x
            Timer(x) = New Timer
            Timer(x).Interval = 10
            AddHandler Timer(x).Tick, AddressOf TimerEventProcessor
            Timer(x).Start()
            wow = "wow"
            Return 0
        Else
            r(x) = New PictureBox
            r(x).Image = My.Resources.n1
            r(x).Visible = True
            r(x).Top = 278
            r(x).Width = 25
            r(x).Height = 25
            r(x).Left = 12
            r(x).BringToFront()
            Controls.Add(r(x))
            track(x) = x
            Timer(x) = New Timer
            Timer(x).Interval = 10
            AddHandler Timer(x).Tick, AddressOf TimerEventProcessor
            Timer(x).Start()
            x = x + 1
            Return 0
        End If

    End Function

    Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
        If e.KeyChar = "1" Then
            If r(x).Bounds.IntersectsWith(red.Bounds) Then
                MsgBox("Werx")
            End If
        End If
    End Sub


  
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        makeR()
        makeR()
    End Sub
End Class

User is offlineProfile CardPM

Go to the top of the page


.Maleficus.
post 7 May, 2008 - 03:16 PM
Post #2


D.I.C Head

**
Joined: 7 Mar, 2008
Posts: 123



Thanked 2 times
My Contributions


Did you have a question, or just showing us some code..?
User is offlineProfile CardPM

Go to the top of the page

citricube
post 9 May, 2008 - 02:05 PM
Post #3


New D.I.C Head

*
Joined: 21 Jan, 2008
Posts: 24

ehhh i needed assistance but i'm trashin the whole arrays of timers and pictureboxes and im gunna make something more easy
User is offlineProfile CardPM

Go to the top of the page

jamesb
post 24 Jun, 2008 - 12:11 PM
Post #4


New D.I.C Head

*
Joined: 24 Jun, 2008
Posts: 27


My Contributions


A little old of a bump...but info is info, right!?

It sometimes helps to have an example of code to look at...So maybe this link will do you some good:
http://fretsonfire.sourceforge.net/

Its an opensource clone of GuitarHero.
User is offlineProfile CardPM

Go to the top of the page

subin2008
post 27 Jul, 2008 - 09:10 PM
Post #5


New D.I.C Head

*
Joined: 27 Jul, 2008
Posts: 1

QUOTE(citricube @ 6 May, 2008 - 01:27 PM) *

I am Making a cheesy Guitar Hero like program and wanted to make a simple method to make a new note here is my code so far it only makes one note move and then the rest made with makeR() stay in place b/c their timer doesn't control them

CODE


Public Class Form1
    Dim x
    Dim r(9999) As PictureBox
    Dim track(9999) As Integer
    Dim Timer(9999) As Timer
    Dim wow = ""
    Public Event Tick As EventHandler

    Private Sub TimerEventProcessor(ByVal myObject As Object, _
                                          ByVal myEventArgs As EventArgs)
        r(track(x)).Top = r(track(x)).Top - 1
    End Sub
    Private Function makeR()
        If x = 9999 Or wow = "wow" Then
            x = x - 1
            r(x) = New PictureBox
            r(x).Image = My.Resources.n1
            r(x).Visible = True
            r(x).Top = 278
            r(x).Width = 25
            r(x).Height = 25
            r(x).Left = 12
            r(x).BringToFront()
            Controls.Add(r(x))
            track(x) = x
            Timer(x) = New Timer
            Timer(x).Interval = 10
            AddHandler Timer(x).Tick, AddressOf TimerEventProcessor
            Timer(x).Start()
            wow = "wow"
            Return 0
        Else
            r(x) = New PictureBox
            r(x).Image = My.Resources.n1
            r(x).Visible = True
            r(x).Top = 278
            r(x).Width = 25
            r(x).Height = 25
            r(x).Left = 12
            r(x).BringToFront()
            Controls.Add(r(x))
            track(x) = x
            Timer(x) = New Timer
            Timer(x).Interval = 10
            AddHandler Timer(x).Tick, AddressOf TimerEventProcessor
            Timer(x).Start()
            x = x + 1
            Return 0
        End If

    End Function

    Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
        If e.KeyChar = "1" Then
            If r(x).Bounds.IntersectsWith(red.Bounds) Then
                MsgBox("Werx")
            End If
        End If
    End Sub


  
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        makeR()
        makeR()
    End Sub
End Class



User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/10/08 11:57AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month