comparison src/creep.c @ 9:5ec4707a3fd1

Forgot to add creep.c
author Mike Pavone <pavone@retrodev.com>
date Sun, 12 Jan 2014 16:03:33 -0800
parents
children c0bb53eaa6f4
comparison
equal deleted inserted replaced
8:2fde9ab7308f 9:5ec4707a3fd1
1 #include <genesis.h>
2 #include "creep.h"
3
4 creep creeps[MAX_CREEPS];
5 u16 cur_creeps;
6 extern u16 tilemap[40*28];
7
8 u16 spawn_creep(u8 species, s16 x, s16 y)
9 {
10 u16 index;
11 for (index = 0; index < MAX_SPRITE; index++)
12 {
13 if (spriteDefCache[index].posx <= 0) {
14 break;
15 }
16 }
17 if (index > 0) {
18 VDP_setSprite(index, x, y, SPRITE_SIZE(1, 1), TILE_ATTR_FULL(2, 0, 0, 0, 'C' + TILE_FONTINDEX), spriteDefCache[0].link);
19 spriteDefCache[0].link = index;
20 } else {
21 VDP_setSprite(index, x, y, SPRITE_SIZE(1, 1), TILE_ATTR_FULL(2, 0, 0, 0, 'C' + TILE_FONTINDEX), 0);
22 }
23 creeps[cur_creeps].index = index;
24 creeps[cur_creeps].health = 1000;
25 creeps[cur_creeps].species = species;
26 creeps[cur_creeps].direction = 0;
27 return cur_creeps++;
28 }