OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
automaton.c File Reference
#include <snes.h>
#include <snes/map.h>
#include <snes/object.h>
#include "res/automaton.inc"

Macros

#define AUTOMATON_DRAW_DX   (-10)
#define AUTOMATON_DRAW_DY   (-16)
#define AUTOMATON_FRAMES   4
#define AUTOMATON_LEFT   1
#define AUTOMATON_RATE   6
#define AUTOMATON_RIGHT   2
#define AUTOMATON_XVELOC   0x0030 /* 3/16 px a frame */

Functions

void automatoninit (u16 xp, u16 yp, u16 type, u16 minx, u16 maxx)
 Create a patrol automaton (object type 2) patrolling between minx and maxx.
void automatonupdate (u16 idx)
 The automaton's per-frame update: patrol, animation, sprite position.

Variables

u16 automatonnum
s16 automatonx
s16 automatony
u16 nbobjects
 Shared sprite palette for all entity types (BGR555).

Macro Definition Documentation

◆ AUTOMATON_DRAW_DX

#define AUTOMATON_DRAW_DX   (-10)

◆ AUTOMATON_DRAW_DY

#define AUTOMATON_DRAW_DY   (-16)

◆ AUTOMATON_FRAMES

#define AUTOMATON_FRAMES   4

◆ AUTOMATON_LEFT

#define AUTOMATON_LEFT   1

◆ AUTOMATON_RATE

#define AUTOMATON_RATE   6

◆ AUTOMATON_RIGHT

#define AUTOMATON_RIGHT   2

◆ AUTOMATON_XVELOC

#define AUTOMATON_XVELOC   0x0030 /* 3/16 px a frame */

Function Documentation

◆ automatoninit()

void automatoninit ( u16 xp,
u16 yp,
u16 type,
u16 minx,
u16 maxx )

Create a patrol automaton (object type 2) patrolling between minx and maxx.

◆ automatonupdate()

void automatonupdate ( u16 idx)

The automaton's per-frame update: patrol, animation, sprite position.

Variable Documentation

◆ automatonnum

u16 automatonnum

◆ automatonx

s16 automatonx

◆ automatony

s16 automatony

◆ nbobjects

u16 nbobjects
extern

Shared sprite palette for all entity types (BGR555).

Running count of active objects in the level.

Initialized to 1 (Kit is always object 0) and incremented as enemies are loaded from the map's object layer by objLoadObjects().