★ VB.NET | Mouse Maze ★

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
18 posts Page 1 of 2
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

★ VB.NET | Mouse Maze ★
CleverBoy
Hello guys, in this tutorial im going to teach you how to make a mouse maze game in vb.net it will be done in visual basic 2010 if you don't have it download it from Visual Basic 2010

»Ok now start Visual basic and create new project (Windows Form Application) and name it whatever you want

Image

The Designing part :-

»Now change the Form Properties
Text = "Mouse Maze" you can name it whatever you want
FormBorderStyle = "Fixed Single"
MaxmimizeBox = False

Image

»Add Lines from Toolbox > VisualBasic PowerPacks > Line
»Add 1 Label from Toolbox > Common Controls > Label
»Add 1 Button from Toolbox > Common Controls > Button

Image

»Change Label1 Text to Start
»Change Button1 Text to Win!
»Change Button1 Enabled to False
»And Now Design the Maze with the lines and add in the start The label and at the end the Button

Image

Now The Coding Part :-

»Double-Click on Label1(Start)
And change the "Click" ( At the top ) to "Mouse Enter"

Image

»and add this code between Private Label1_Mouse Enter.... And End Sub
Code: Select all
Button1.Enabled = True 'It will enabled the win button so you can click it and win!
»Back to the form and double-click on Button1(Win)
Add this code
Code: Select all
Msgbox("You Won!") 'Will popup a message and the text will be between " and "
»Now the hardest part, On Each Line you must double-click it and change the "Click" to "Mouse Enter"
and add this code
Code: Select all
Button1.Enabled = False 'it will disable the win button so you must go to start and go to win
For additional features like "Times Losed and Times Won"

Add four labels at the buttom and Change label2 text to "Times Won : "
Change Label3 text to "0"
Change Label4 text to "0"
And Arrange it from label2 to label 5
and now change the button1(win) code to
Code: Select all
Msgbox("You Win!")
Label3.text += 1
And Change everyline code!! to
Code: Select all
Button1.Enabled = False
Label5.text = += 1
The whole Codes (Delete all codes and paste this)
Code: Select all
Public Class Form1


    Private Sub Label1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseHover
        Button1.Enabled = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("You Won!")
        Label3.Text += 1
    End Sub

    Private Sub LineShape10_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape10.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape9_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape9.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape8_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape8.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape7_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape7.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape6_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape6.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape5_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape5.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape4_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape4.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape3_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape3.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape2.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
    Private Sub LineShape1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LineShape1.MouseEnter
        Button1.Enabled = False
        Label5.Text += 1
    End Sub
End Class

If you want a source code for Mouse Maze Game With Levels and lifes and many other features make 4 things !
(Rate, Download, Comment, +rep!)
You do not have the required permissions to view the files attached to this post.
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
BlakPilar
New Member
New Member
Posts: 15
Joined: Fri Apr 08, 2011 7:49 pm

Re: ★ VB.NET | Mouse Maze ★
BlakPilar
You can simplify all of your .MouseEnter subs there that handle the lines by doing something like this:
Code: Select all
Sub LinesMouseEnter(ByVal sender As Object, ByVal e as EventArgs) Handles Line1.MouseEnter, Line2.MouseEnter, Line3.MouseEnter, etc.
    Dim line As Line = CType(sender, Line)
    'The rest of your code will go here. The entered line's data will be stored into "line"
End Sub
Also, it is good programming practice to rename your components with their corresponding 3-letter prefix and a name (for a line, it's "lne"), instead of something like "Line1", etc.

EDIT: "Line" might be "LineShape", now that I look at your code again. Not sure though, I've never used one.
Image
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

Re: ★ VB.NET | Mouse Maze ★
CleverBoy
Thanks BlakPilar and about the Line and LineShape its the same lol!
Thanks for your comment
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: ★ VB.NET | Mouse Maze ★
code it
Nice job CleverBoy cooll; !
User avatar
shekoasinger
New Member
New Member
Posts: 23
Joined: Sat Dec 04, 2010 9:40 pm

Porbs doesn´t detect it when mouse is really fast mate.
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

Re: ★ VB.NET | Mouse Maze ★
CleverBoy
@shekoasinger
to make it detect the fast movements use
instead of "MouseHover" , "MouseEnter"
Thanks
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
RunarM
Hardcore Programmer
Hardcore Programmer
Posts: 508
Joined: Wed Nov 18, 2009 11:33 pm

Re: ★ VB.NET | Mouse Maze ★
RunarM
Was bored so i updated it a bit.
mm.zip
You do not have the required permissions to view the files attached to this post.
Just another day in my life.
http://www.codexvideos.com
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

Re: ★ VB.NET | Mouse Maze ★
CleverBoy
Thank you Runar for the red lines :D
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
RunarM
Hardcore Programmer
Hardcore Programmer
Posts: 508
Joined: Wed Nov 18, 2009 11:33 pm

Re: ★ VB.NET | Mouse Maze ★
RunarM
*Updated it again =)
*The blue one is to open the orange one.
Nosleep.png
You do not have the required permissions to view the files attached to this post.
Just another day in my life.
http://www.codexvideos.com
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: ★ VB.NET | Mouse Maze ★
troop
guys im making same this app in vb.net 2013 i have done login and registration and now i found i dont have the line shape in my vb :( it doesnt even have Visaul Basic Powerpacks in the tool box

do u know how to get that??

loove;
18 posts Page 1 of 2
Return to “Tutorials”