Game Programming Class5
Contents
Game Services
Review Game Components
IntroGameLibrary
Turn the console class into a service
Each GameService needs to have a unique interface so that there is an entry in the system types table. The interface allows the game to return the correct type.
- GameConsole.cs
All of these files are available in the IntoGameLibrary Project in the classfolders.
Advanced Sprites/Collision
Simple Collision
Check if two rectangles intersect. By adding a rectangle that represents the area of the sprite it's easy to ask XNA if two rectangles intersect
3 tutorial on App Hub
- http://xbox.create.msdn.com/en-us/education/catalog/tutorial/collision_2d_rectangle
- http://xbox.create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel
- http://xbox.create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel_transformed
PerPixelCollision
Load both textures into a color array. Make a rectangle of the intersection of the two textures. Check all the pixels in intersection of the color arrays for intersecting pixels.
The definition for both methods is in the Sprite class (Sprite.cs)
Chase and Evade
Example of simple states and simple vector geometry.
Better example not yet implemented
PacMan Chase and Evade example in repo IntroChaseEvade demostratea
- Collision
- State for feeble AI
- Sprite Markers
Homework
InputControllerMonogame
InputControllerUnity