Difference between revisions of "Game Programming Class3"
esse quam videri
m (→Input) |
|||
Line 3: | Line 3: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==in class== | ==in class== |
Revision as of 20:06, 30 January 2011
Contents
Class 3 Input Handling
in class
Extract sprite from pacman class and build new project
http://www.xnawiki.com/index.php?title=Basic_Sprite_Class
Sprite class
IntroPacManComponent.zip
Project that refactors the pacman class into two classes
Sprite.cs DrawableSprite.cs
Then the pacman class can inherit from one of these two classes.
PacMan.cs
Due to the desire to limit the number of spritebatches, I've created two classes. The sprite class cannot draw itself without being associated with and external spritebatch. The DrawableSprite has it's own spritebatch which makes it easier to use but less efficient.
Classes and Generics
Shooting with pacman
List<Type> Safer than Arraylist and easier to manage than Array
Homework
Moving Game
- Create an XNA project that uses the Keyboard for input.
- Has at least 3 different moving sprite with a common code base.
- the sprites should inherit from the same class. Game components are a plus. don't worry about collision yet
- Read Chapter 3 in XNA 3.0