Home

Forum

Games

~~~~~~~~~~~~~

Chapter
Examples



Programming 2D Games

Official site of "Programming 2D Games" the book
by: Charles Kelly

Chapter 5 Sprites and Animation

Planet

Fills the window with the image of a nebula and draws a planet over the nebula.

  • The planet is drawn using a DirectX sprite with transparency.

Planet

download......(Source Included)

Sprite Border

Draws a spaceship at 1X scale and again at 8X scale.

  • The 8X ship has a visible border because the source image does not have a minimum 1 pixel wide transparent border.

Sprite Border

download......(Source included)

Spaceship

Adds an animated spaceship to the Planet program from above.

  • Demonstrates how to use the Image class to draw animated sprites.

Spaceship

Download......(Source included)

Spaceship Movement

A spaceship flies from left to right across the space scene while rotating and getting smaller.

  • Demonstrates how to move and rotate an Image.
  • Demonstrates how to make Images wrap around the window.

Spaceship Movement

download......(Source Included)

 

Spaceship Control

An animated spaceship may be moved around the window by pressing the arrow keys. 

  • Demonstrates how to get user input with the Input class.

Spaceship Control

download......(Source included)


Creative Commons License
Programming 2D Games Examples by Charles Kelly are licensed under a Creative Commons Attribution 3.0 Unported License.

 

This website copyright © 2012 by Charles Kelly, All Rights Reserved

Last Updated:

24 May, 2013