.NET
  Home arrow .NET arrow Page 9 - Game Development of .Nettrix: GDI+ and Col...
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? 
.NET

Game Development of .Nettrix: GDI+ and Collision Detection
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2004-08-23

    Table of Contents:
  • Game Development of .Nettrix: GDI+ and Collision Detection
  • Performing Graphic Operations with a Graphics Object
  • Creating Gradients
  • Collision Detection
  • Proximity Algorithms
  • Optimizing the Number of Calculations
  • Extending the Algorithms to Add a Third Dimension
  • Develop a Real Game Proposal
  • Diagrams of Basic Game Objects
  • The Game Engine
  • The Coding Phase
  • Testing the Program
  • The Block Class
  • The Constructor
  • The Down, Right, and Left Methods
  • The Rotate Method
  • The Show and Hide Methods
  • Final Version: Coding the GameField Class and the Game Engine
  • The CheckLines Method
  • The Game Engine
  • Adding the Final Touches
  • Further Improvements

  • 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


    Game Development of .Nettrix: GDI+ and Collision Detection - Diagrams of Basic Game Objects


    (Page 9 of 22 )

    The Class Diagram: First Draft

    Start with a simple class diagram (shown in Figure 1-20) illustrating the basic structures of the objects for your game, and then you can add the details and go on refining until you have a complete version. Almost all of the object-oriented analysis methodologies suggest this cyclic approach, and it’s ideal to show how the game idea evolves from draft to a fully featured project.

    From this game proposal you can see the first two classes: Block, which will represent each game piece, and Square, the basic component of the blocks.


    Figure 1-20. The class diagram—first draft

    Based on the game proposal, you can determine some methods (functions) and properties (variables) for the Block class, as described in Table 1-1.

    Table 1-1. The Block Class Members

    TYPE

    NAME DESCRIPTION

    Method

    Down

    Makes the block go down on the screen

    Method Right Moves the block right
    Method Left Moves the block left
    Method Rotate Rotates the block clockwise
    Property Square 1 Specifies one of the squares that compose the block
    Property Square 2 Specifies one of the squares that compose the block
    Property Square 3 Specifies one of the squares that compose the block
    Property Square 4 Specifies one of the squares that compose the block

    Each block is composed of fours objects from the Square class, described in Table 1-2.

    Table 1-2. The Square Class Members

    TYPE NAME DESCRIPTION
    Method Show Draws the square on the screen at its coordinates (Location property) and with its size (Size property),colored with a specific color (ForeColor property) and filled with BackColor
    Method Hide Erases the square from the screen
    Property ForeColor Specifies the square’s foreground color
    Property BackColor Specifies the square’s background color
    Property Location Specifies the x,y position of the square on the screen
    Property Size Specifies the height and width of the square

    Comparing the two tables, you can see that there are methods to show and hide the square. Because the squares will be drawn from the Block object, you must have corresponding methods in the Block class and the corresponding properties, too. You can adjust the first diagram accordingly to produce Figure 1-21.


    Figure 1-21. The class diagram---second draft

    You use SquareSize as the size property for the block, since it’s not important to know the block size, but the block must know the size of the squares so that it can create them.

    You can return to this diagram later and adjust it if necessary. Now turn your attention to the game engine, described in the next section.

    This chapter is from Beginning .NET Game Programming in C#, by David Weller, et al., (Apress, 2004, ISBN: 1590593197). Check it out at your favorite bookstore today.

    Buy this book now.

    More .NET Articles
    More By Apress Publishing


       · Examples from the first page are invalid. You cannot do:Graphics g = new...
     

    .NET ARTICLES

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek