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

Macros

#define INSECT_DRAW_DX   (-8)
#define INSECT_DRAW_DY   (-14)
#define INSECT_FRAMES   4
#define INSECT_LEFT   1
#define INSECT_RATE   6
#define INSECT_RIGHT   2
#define INSECT_XVELOC   0x0040 /* 1/4 px a frame */

Functions

void insectinit (u16 xp, u16 yp, u16 type, u16 minx, u16 maxx)
 Create a robot insect (object type 1) patrolling between minx and maxx.
void insectupdate (u16 idx)
 The insect's per-frame update: patrol, animation, sprite position.

Variables

u16 insectnum
s16 insectx
s16 insecty
u16 nbobjects
 Shared sprite palette for all entity types (BGR555).

Macro Definition Documentation

◆ INSECT_DRAW_DX

#define INSECT_DRAW_DX   (-8)

◆ INSECT_DRAW_DY

#define INSECT_DRAW_DY   (-14)

◆ INSECT_FRAMES

#define INSECT_FRAMES   4

◆ INSECT_LEFT

#define INSECT_LEFT   1

◆ INSECT_RATE

#define INSECT_RATE   6

◆ INSECT_RIGHT

#define INSECT_RIGHT   2

◆ INSECT_XVELOC

#define INSECT_XVELOC   0x0040 /* 1/4 px a frame */

Function Documentation

◆ insectinit()

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

Create a robot insect (object type 1) patrolling between minx and maxx.

◆ insectupdate()

void insectupdate ( u16 idx)

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

Variable Documentation

◆ insectnum

u16 insectnum

◆ insectx

s16 insectx

◆ insecty

s16 insecty

◆ 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().