Assignment 1: A tiny game
Due date: Wednesday, Sept 22
To get started with XNA, we will use one of the
simplest pieces of XNA: 2D graphics using sprites.
Your task will be to build a tiny game.
The assignment is intended to give you some practice coding in
XNA and learning your way around. It also lets you try out a simple
game idea you may have had.
Part 1: getting started
- Make sure you have XNA Game Studio Express 3.1 running on your computer.
- Run it and start a new project (a Windows game).
- Start coding!
Part 2: the sprites
- Add a sprite and a sprite font to the content of your project.
- Add the necessary variables and use Content.Load to load your sprite image and sprite font.
- Using the SpriteBatch, draw the image and some text on the screen.
- Test your program to make sure that the drawing is working at this point.
Part 3: basic interaction
- make a Vector2 variable to hold the sprite's position. Also make a Vector2 variable to hold the current direction of motion of the sprite.
- In the Update method, update the position by incrementing it by the direction vector.
- Also, modify the direction vector according to the key pressed. (For example, you might have I=up, J=left, K=right, M=down.)
- In the Draw method, use your sprite font to display a message on the screen.
- Test that everything works.
Part 4: A tiny game
Now that you have got the basics down, use them to build a tiny game.
This could be a version of a classic game such as Asteroids or Pong,
or it could be a design of your own invention. Remember that you have only
a week so keep it simple.
Your game can be pretty much anything as long as it meets these basic criteria:
- Has some movement. (At least one thing on the screen has to move around.)
- Has some player interaction. (There must be something that the player controls.)
- Has some environment interaction. (There must be at least one object onscreen to interact with besides the player; such objects might be obstacles, enemies, hazards, or treasure.)
- Has some status update in text. (This could be a score changing, warning messages, or anything that is appropriate for your game.)
Part 5: bonus
- For a bonus of up to +5%, add a sound effect to your game, triggered by
some event that happens. If you like, you can have looping
background music instead to fulfil this task.
- For a further bonus of up to +5% more, find a sprite sheet online and have your sprite cycle through frames of the animation.
Handing it in
Hand in your project using WebCT.
The easiest thing to do is to create a single zipped folder and submit
that, rather than all the individual files. It might take a while to
upload, so be prepared to take a little break while the files are in
transit.