I210: Information Infrastructure
I (Intro to Programming) — Graphical Programming
Since some of the game design for the Final Exam Game Project must take place before you learn the specific techniques for doing graphical programming in Python (using LiveWires), here are some notes on what you need to know (and will learn) about graphical programming. Most of these techniques are common to all forms of graphical programming in all languages, though Python and LiveWires make some of these methods particularly convenient and easy.
You will be able to:
á
Open a graphics window
You
can open (create) a window of a specifiable width and height in which to render
your graphics.
á
Use a picture of your choosing for the
background of the graphics window
You
can obtain a .bmp picture from any source and use it as the background for your
game.
á
Use pictures of your choice as
"sprites" that you can position and move around
You
can obtain small .bmp pictures from any source and use them as animated game
pieces. The locations of sprite objects are specified using (x,y) coordinates, with (0,0) at
the top left of the window and (width-1,height-1) at the bottom right of the
window.
á
Get your sprite objects to change position
incrementally via an ÒupdateÓ method
The
LiveWires game module you will be using will
automatically call your objectsÕ ÒupdateÓ method for each time step (each
frame), so you can incrementally move objects around inside the window.
á
Find out when objects collide (overlap)
You
will be able to tell when any of your objects collide by asking for a list of
all objects with which it overlaps.
á
Put text in your window
You
can display a game score, instructions, or whatever text you want in your
window. The locations of text are specified using (x,y) coordinates, with (0,0) at the top left of the
window and (width-1,height-1) at the bottom right of the window.
á
Show temporary text in your window
You
can ask the game module to display text in your window temporarily, and have it
automatically removed after a specified amount of time has passed.
á
Read the mouse position, so you can use it to
control objects in your window
You can tell where the mouse is and
use it to move things around on screen.
á
Read keys pressed on the keyboard, so you can
control game actions (this will require you to read ahead to Chapter 12, which
we will not be covering in class, though we will cover keyboard input if there
is time)
You
can tell if any keys are pressed on the keyboard, allowing you to move objects
around, change game options, or do whatever you want using the keyboard.
á
You can play sounds, including playing multiple
sounds at the same time.
The
Livewires package provided with the book will let you load and play sounds once,
a specific number of times, or looping continuously. You can stop these sounds on demand. And you can play multiple sounds at the
same time.
|
|
For more information, contact: |