SSE643Project3-XNAGameClass

=XNA Game Class =

=4. XNA Game Class=

 4.1. To make the game operate you have to define a lot of variables/objects. The below image details the members of the GameClass object and the members we are using. If also shows all of the methods that are used throughout the game.



 4.2. We start off declaring all of the class members that we will use in the program. I described several of the main ones in previous part of the report.



 4.3. We continue to declare variables. We also define the List Objects that we use to track all of the data that is on the screen.



 4.4. The game constructor sets up the Quadrant object as well as the Menu object. There is also an option to run the game in full screen mode.



 4.5. The load content start to get all of the objects declared for the game environment.



 4.6. The remaining portion of the load content method.



 4.7. The GameReset method was created so we could restart the game with now objects every time you select the start from the main menu.



 4.8. The Unload Content method is not utilized at this point.



 4.9. The update method is where we have the logic between the menu class and the actual game objects. We have some global keyboard options that effect game play. They are Q which exits you from the game, P which will pause the game, and M which will mute the sound.



 4.10. The main feature of the Update method is the GameState variable. This Boolean checks to see if the game has been started. If it has it goes through the operations the game needs to do to make it work. Such as moving the ship and firing the lasers. If the escape key is hit it will take you back to the main menu.



 4.11. If the game is in menu mode it looks for a start state to start the game. If the ship has collected the correct amount of Ore the ship teleportation graphic is started and the teleport counter is incremented.



 4.12. After the check for game state and for the win, the game works through all of the objects in the game.



 4.13. The update laser method looks to see if the laser is alive and moves it to its next position. It also checks to see if it encounters any asteroids. If it does it runs the explosion sound and animation.



 4.14. If the asteroid state is large the rock produces two medimum asteroids and releases elements. If it is edimum it adds two small asteroids to the screen.



 4.15. If the asteroid is small it is destroyed. Then the laser method looks for enemy ships



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.16. It looks for bugs.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.17. Then it looks for enemy lasers



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.18. The update elements looks to see if the ship collected it.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.19. This method adds the amount of ore mined to the display counter.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.20. The fire laser method sets the laser on the correct path from the ship and activates it.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.21. If there is enough laser fuel the lasers can be upgraded to shoot more that one.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.22. The update asteroids method starts out by rotating the asteroid.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.23. Then it looks to see if the shop hits a rock. If it does it destroys the entire rock and reduces the ships hit counter.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.24. This method looks to see if the ship collides with an enemy ship.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.25. The update Bugs method looks for os3 ore and will collect it if it is available.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.26. The FireEnemyLaser fires lasers at the main ship when it collects os3 ore.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.27. The GetRandomPositionOnScreen gets random coordinates for objects and places them in their random quadrants.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.28. These methods get random images to change up the look and feel of the game.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.29. These methods get random images to change up the look and feel of the game.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.30. Creates additional asteroids when a larger one is destroyed.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.31. This method makes the bug go towards the os3 when it is available. The SendMiningAlert produces a sound and tells the player that they got some os3.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.32. The Draw method writes all of the graphics to the screen. If the menu is enabled it just draws the menu screen. Otherwise it will start by drawing the ship, with animation if it is moving.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.33. Draws explosions, asteroids, lasers…



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.34. elements, enemy ships, bugs, …



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.35. and finally enemy lasers. Then it checks for a win status and draws the teleportation graphic if there is a win state.



<span style="font-family: Tahoma,Geneva,sans-serif; font-size: 12pt;"> 4.36. If there is no win state then the ship was destroyed. After the main assets are drawn the data for the status menu is drawn.



<span style="display: block; font-family: Tahoma,Geneva,sans-serif; font-size: 115%; text-align: center;">Project Home Next Section