Objects
Jump to navigation
Jump to search
An object is an entity in the game that is usually represented with sprites.
Representation
All memory in wram bank 1 is dedicated to storing memory for objects (4 kilobytes total). Each object has a dedicated 64 bytes of memory in this region.
There are a few different "classes" or types of objects. To help improve the speed of accessing objects, each class resides in a specific area of memory; in this way, the low byte of a particular class of objects is always the same, so the address of a particular variable can be determined with a simple register load, and no addition or indexing is required.
See include/structs.s for the memory layouts of objects.
| Object type | Memory region | Slots (values for x) | Object description | ID List |
|---|---|---|---|---|
| Special object | dx00-dx3f | 0-1 | Link, animal companion, maple, raft. Link is always in slot 0 (d000-d03f). | constants/common/specialObjects.s
|
| Parent item | dx00-dx3f | 2-5 | These aren't normally drawn to the screen, but they act as sort of state-holders when using an item. | constants/common/items.s
|
| Item | dx00-dx3f | 6-f | Swords, projectiles; anything that can damage or interact with an enemy. | constants/common/items.s
|
| Interaction | dx40-dx7f | 0-f | Very general; these can be non-hostile entities like npcs, or they may not be drawn at all, instead existing only as scripts to carry out a sequence of events. | constants/common/interactions.s
|
| Enemy | dx80-dxbf | 0-f | Hostile entities; these objects generally react when Link or an item collides with them. | constants/common/enemies.s
|
| Part | dxc0-dxff | 0-f | Frequently used as an enemy's weapon or projectile, so they can cause damage to Link; but this is also a mish-mash of various things, including owl statues. | constants/common/parts.s
|