Visual Basic.NET
  Home arrow Visual Basic.NET arrow Working with Classes and Properties for Ga...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Working with Classes and Properties for Game Development in VB.NET
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-07-01

    Table of Contents:
  • Working with Classes and Properties for Game Development in VB.NET
  • Creating an Adventurer Class
  • Setting Properties and Defining Constructors
  • Creating a Tile Class

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Working with Classes and Properties for Game Development in VB.NET


    (Page 1 of 4 )

    We've covered console input and output, variables, conditionals, loops, arrays and collections. With these tools, we're finally ready to begin constructing our game, whose basic plan we looked at in the first article of this series. It's been a while (this is the sixth of nine parts), so if you need a refresher, feel free to go back to the first article to take another look at the plan.

    Setting Up the Window

    Here's what we should have right now:

    Module Game


     Sub Main()


     End Sub


    End Module

    The first thing we need to do is set up the console window for our game. We need to give the window a proper size so that the interface fits on the screen, and we also need to give our game a title. I'm going to use the title "VB Quest," but feel free to use your own, more creative title. This code goes right at the top of Main:

    Console.Title = "VB Quest"

    Console.SetWindowSize(80, 35)

    You can see what the window looks like by placing a call to ReadKey at the bottom. This will keep the window open until a key is pressed. If we set the window size to too small of a size, then the terminal window will scroll down, and the top lines of our game will not be visible.

    When the user runs the game, he may have started execution by typing the name of the program into the console. If this is the case, there will be some text in the console already. We don't want anything to be in the console window already, so let's clear anything that might be there:

    Console.Clear()

    When the user opens the application, the first thing we need to do is welcome him to the game. This is easy. A short sentence will do, unless you feel artistic and want to decorate it somehow (maybe add some color?-you know how):

    Console.WriteLine("Welcome to VB Quest.")

    Then we need to ask him his name. This is also easy:

    Console.WriteLine("What is your name?")

    Console.Write(" >")

    Dim name As String = Console.ReadLine()

    More Visual Basic.NET Articles
    More By Peyton McCullough


       · Hello, all,This is a continuation of my series introducing Visual Basic .NET,...
       · Hi, I think this is just super :) keep up the good work and i will keep on pressing...
     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT