28029 Parallax Inc, 28029 Datasheet - Page 191

KIT PARTS SMART SENSORS W/TEXT

28029

Manufacturer Part Number
28029
Description
KIT PARTS SMART SENSORS W/TEXT
Manufacturer
Parallax Inc
Datasheet

Specifications of 28029

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp® or Javelin Modules
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Other names
28029PAR
ACTIVITY #2: BACKGROUND STORE AND REFRESH WITH EEPROM
In a video game, when your game character isn’t on the screen, all that’s visible is the
background. As soon as your game character enters the screen, it blocks out part of the
background. When the character moves, two things have to happen: (1) the game
character has to be re-drawn at the new location, and (2) the background that the game
character was blocking out has to be re-drawn. If step 2 never happened in your program,
your screen would fill up with copies of your game character.
Televisions and CRT computer monitors refresh every pixel many times per second. The
refresh rate on televisions is around 30 Hz, and a few of the more common refresh rates
on CRTs are 60, 70, and 72 Hz. Other devices like certain LCD and LED displays hold
the image automatically, or sometimes with the help of another microcontroller. All the
program or microcontroller that controls these devices has to do is tell them what to
display or change. This is also how video compression on your computer works. In
order to reduce the file size, some compressed video files store the changes to the image
instead of all the pixels in a given image frame.
When used with displays that do not need to be refreshed (like the Debug Terminal or an
LCD), the BASIC Stamp EEPROM can store an image of a game or graph background in
its EEPROM. When a game character moves and is redrawn at a different location, the
BASIC Stamp can just read its EEPROM and redraw the background characters at the
game character’s old location. To do this, simply save the old coordinates of the game
character before it moved and then use those coordinates to retrieve the background
character from EEPROM. Depending on how large the display is, this can save a
considerable amount of time that the BASIC Stamp might need to perform other tasks.
This activity introduces three elements to game characters and backgrounds:
Background Display from EEPROM
This display doesn’t have to be made with a single
needs to be maintained as a background with characters traveling over it in the
foreground. Instead, it’s better to store the characters in EEPROM and then display them
1. Storing and displaying the background from EEPROM
2. Tracking a character’s old and new coordinates
3. Redrawing the old coordinates from EEPROM
Chapter 5: Accelerometer Gaming Basics · Page 179
DEBUG
command, especially if it

Related parts for 28029