Mercurial > repos > genjam1
diff src/main.c @ 21:bb7dfb42b320
Small refactor to object placement. Add spawn point object
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 12 Jan 2014 23:53:18 -0800 |
parents | 51a0972fcf76 |
children | b725a715b358 |
line wrap: on
line diff
--- a/src/main.c Sun Jan 12 22:43:03 2014 -0800 +++ b/src/main.c Sun Jan 12 23:53:18 2014 -0800 @@ -42,11 +42,6 @@ }; -#define EMPTY 0 -#define WALL 'O'-32 + TILE_FONTINDEX -#define TOWER TILE_ATTR_FULL(1, 0, 0, 0, 'T'-32 + TILE_FONTINDEX) -#define GOAL TILE_ATTR_FULL(1, 0, 0, 0, 'G'-32 + TILE_FONTINDEX) - u16 countdown; int cursor_x = 0; // tiles @@ -79,18 +74,11 @@ } if (went_down & BUTTON_A && !running) { //u16 type_to_place = EMPTY; - u16 type_to_place = WALL; - tilemap[cursor_x + (cursor_y ) * 40] = type_to_place; - tilemap[cursor_x + 1 + (cursor_y ) * 40] = type_to_place; - tilemap[cursor_x + (cursor_y + 1) * 40] = type_to_place; - tilemap[cursor_x + 1 + (cursor_y + 1) * 40] = type_to_place; + place_object(WALL, cursor_x, cursor_y); gen_distances(38, 14); if (distances[122/16] == 0xFFFF) { - tilemap[cursor_x + (cursor_y ) * 40] = 0; - tilemap[cursor_x + 1 + (cursor_y ) * 40] = 0; - tilemap[cursor_x + (cursor_y + 1) * 40] = 0; - tilemap[cursor_x + 1 + (cursor_y + 1) * 40] = 0; + place_object(EMPTY, cursor_x, cursor_y); } } if (went_down & BUTTON_START) @@ -116,16 +104,13 @@ tilemap[i+1] = WALL; } */ - - tilemap[38 + 14*40] = GOAL; - tilemap[39 + 14*40] = GOAL; - tilemap[38 + 15*40] = GOAL; - tilemap[39 + 15*40] = GOAL; + place_object(GOAL, 38, 14); + place_object(SPAWN, 0, 14); + gen_distances(38, 14); for (i = 0; i < MAX_SPRITE; i++) { spriteDefCache[i].posx = -0x80; } - gen_distances(38, 14); //print_distances(); for (;;) { @@ -142,7 +127,7 @@ --countdown; else if (cur_creeps < 4) { - spawn_creep(CREEP_NORMAL, 4, 122); + spawn_creep(CREEP_NORMAL, 0+4, 14*8+4); countdown = 300; } update_creeps();