Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 2 - The Basics of VB.NET Through Text Game Dev...
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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

The Basics of VB.NET Through Text Game Development
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-06-04

    Table of Contents:
  • The Basics of VB.NET Through Text Game Development
  • Working with the Console
  • Working with the Console continued
  • Changing Color

  • 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


    The Basics of VB.NET Through Text Game Development - Working with the Console


    (Page 2 of 4 )

    So, now we know how to write a line of text to the console, but this, of course, won't be enough for a project like ours. Recall the nature of the game: we have a dungeon made up of tiles, creatures, and items, all of which are really characters. We need to be able to draw every one of these, and we need to be able to redraw them if they move or are covered up or uncovered. For example, if the player walks from one space to another space, then we need to erase the tile he steps on, replacing it with the image of the player, and we need to redraw the tile that he stepped off of, erasing the old image of the player. Moreover, things may need to be represented in different colors, not just the default gray. Clearly, WriteLine isn't going to accomplish all of this, and, in fact, our use of it in the game will be limited.

    WriteLine writes out a string of text and then moves to the next line. In most cases, this isn't what we want at all. We may only need to write one character at a specific location on the screen. To do this, we need a very similar procedure. Write. Write operates much like WriteLine, except it doesn't move to a new line.

    Earlier, we wrote “Hello World” out to the screen like this:


    Console.WriteLine("Hello World.")


    Though it isn't terribly obvious unless you pay attention to the blinking cursor, WriteLine moved to the next line. If we were to write some more text to the screen, it would be more noticeable, since the new text would start on the next line.

    However, a combination (of no real-world value) of Write and WriteLine would have achieved the exact same effect:


    Console.Write("Hello ")

    Console.WriteLine("World.")


    First, we make a call to Write, writing “Hello “ (with a space) out to the screen. We then write “World.” out to the screen with WriteLine. Since Write doesn't add a new line, the call to WriteLine continues writing on the same line.

    We can break it up even further, into three calls, while still achieving the same effect:


    Console.Write("Hello ")

    Console.Write("World.")

    Console.WriteLine()


    While the above sample has no practical purpose, it does illustrate something else we should know: WriteLine can be called with no arguments. If this happens, it simply moves the cursor to the next line. This is useful in some situations.

    But, as noted earlier, we can't adopt a line-by-line approach to creating our game's interface. Rather than writing one line and then moving onto another in a linear fashion, we need to be able to update individual characters. So, how does Write allow us to do this? Alone, it doesn't, but when used in conjunction with another procedure, it allows us to write a character in any location in the console. This is exactly what we need.

    More Visual Basic.NET Articles
    More By Peyton McCullough


       · Hello, all,This is a continuation of the series introduced...
     

    VISUAL BASIC.NET ARTICLES

    - 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...
    - Creating and Drawing a Game Map in VB.NET (F...
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




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