An enemy type identifies an enemy variant whose appearance, movement, animation, collision size, score value, and sprite attributes can differ from other variants. A ROM definition table supplies these values when an enemy is created, while the RAM record stores them for active enemies. section 12.0 section 12.2
Define each enemy type with attributes such as:
- Starting and ending sprite patterns, plus the number of patterns used for animation. section 12.1
- Initial horizontal and vertical movement changes. section 12.1
- Score value, collision width and height, and sprite attributes such as palette selection. section 12.1
- A type number in each RAM record, allowing spawning and movement code to customize behavior. section 12.2
Table 12.1 Enemy definition table (view table figure)
| Name |
Bytes |
Description |
|---|---|---|
| Starting shape |
1 |
Starting sprite pattern number |
| Ending shape |
1 |
Ending sprite pattern number |
| Patterns |
1 |
Number of patterns (and sprites) used |
| DX |
1 |
Any starting change in X (we will randomly choose the direction) |
| DY |
1 |
Any starting change in Y |
| Score |
1 |
The value added to the player’s score when destroyed |
| Width |
1 |
The width of our enemy for collision detection |
| Height |
1 |
The height of our enemy for collision detection |
| Attributes |
1 |
The sprite attributes to use (mainly used here to set the palette) |
Use the enemy definition table as the compact schema for the nine-byte ROM record assigned to each type. section 12.1
Type identifiers in active enemy data
The tracking table records enemy type 1 as a large meteor, 2 as a small meteor, 3 as a smart bomb, and 4 as an explosion. Each active enemy uses ten RAM bytes: the type plus the copied definition data. section 12.2
