annotate src/main.c @ 25:2f56bc29a3d6 default tip

Beefed up the cursor a bit. Cleaned up my unused build order array.
author William Morgan <bill@mrgn.org>
date Tue, 14 Jan 2014 00:06:22 -0800
parents 2cee3dc5fe4d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #include <genesis.h>
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #include "creep.h"
20
51a0972fcf76 Move some tilemap/distance stuff out of creep.c and main.c into a separate source file
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
3 #include "map.h"
2
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
5 const u32 cursor_tiles[4*8] = {
24
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
6 0x11111000, // top left
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
7 0x13322100,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
8 0x13111000,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
9 0x12100000,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
10 0x12100000,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
11 0x01000000,
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
12 0x00000000,
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
13 0x00000000,
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
14
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
15 0x00000000, // bottom left
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
16 0x00000000,
24
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
17 0x01000000,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
18 0x12100000,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
19 0x12100000,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
20 0x13111000,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
21 0x13322100,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
22 0x11111000,
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
23
24
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
24 0x00011111, // top right
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
25 0x00122331,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
26 0x00011131,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
27 0x00000121,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
28 0x00000121,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
29 0x00000010,
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
30 0x00000000,
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
31 0x00000000,
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
32
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
33 0x00000000, // bottom right
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
34 0x00000000,
24
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
35 0x00000010,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
36 0x00000121,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
37 0x00000121,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
38 0x00011131,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
39 0x00122331,
2cee3dc5fe4d Beefed up the cursor a bit. Cleaned up my unused build order array.
William Morgan <bill@mrgn.org>
parents: 23
diff changeset
40 0x00011111,
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
41 };
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
42
7
3ed112d64b1b Added basic creep spawning code
Mike Pavone <pavone@retrodev.com>
parents: 4
diff changeset
43 u16 countdown;
4
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
44
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
45 s16 cursor_x = 0; // tiles
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
46 s16 cursor_y = 0; // tiles
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
47 u16 cursor_selection = WALL;
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
48 #define CURSOR_BLINK_RATE 16
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
49 #define CURSOR_WIDTH 2; // tiles
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
50
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
51 #define PIXELS_PER_TILE 8
15
f71eb24b3896 placement of red walls with a button
William Morgan <bill@mrgn.org>
parents: 14
diff changeset
52
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
53 u8 running = 0;
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
54
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
55 void clear_cursor() {
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
56 VDP_setTileMap(VDP_PLAN_A, 0, cursor_x, cursor_y);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
57 VDP_setTileMap(VDP_PLAN_A, 0, cursor_x + 1, cursor_y);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
58 VDP_setTileMap(VDP_PLAN_A, 0, cursor_x, cursor_y + 1);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
59 VDP_setTileMap(VDP_PLAN_A, 0, cursor_x + 1, cursor_y + 1);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
60 }
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
61
13
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
62 void joy_event_handler(u16 joy, u16 changed, u16 state) {
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
63 u16 went_down = changed & state;
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
64 if (went_down & BUTTON_UP) {
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
65 clear_cursor();
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
66 cursor_y -= CURSOR_WIDTH;
13
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
67 }
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
68 if (went_down & BUTTON_DOWN) {
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
69 clear_cursor();
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
70 cursor_y += CURSOR_WIDTH;
13
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
71 }
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
72 if (went_down & BUTTON_LEFT) {
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
73 clear_cursor();
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
74 cursor_x -= CURSOR_WIDTH;
13
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
75 }
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
76 if (went_down & BUTTON_RIGHT) {
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
77 clear_cursor();
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
78 cursor_x += CURSOR_WIDTH;
15
f71eb24b3896 placement of red walls with a button
William Morgan <bill@mrgn.org>
parents: 14
diff changeset
79 }
23
330e58fb01aa simple object selection
William Morgan <bill@mrgn.org>
parents: 22
diff changeset
80 if (went_down & BUTTON_B && !running) {
330e58fb01aa simple object selection
William Morgan <bill@mrgn.org>
parents: 22
diff changeset
81 cursor_selection = (cursor_selection + 1) % GOAL;
330e58fb01aa simple object selection
William Morgan <bill@mrgn.org>
parents: 22
diff changeset
82 }
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
83 if (went_down & BUTTON_A && !running) {
23
330e58fb01aa simple object selection
William Morgan <bill@mrgn.org>
parents: 22
diff changeset
84 place_object(cursor_selection, cursor_x, cursor_y);
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
85 gen_distances(38, 14);
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
86 if (distances[122/16] == 0xFFFF)
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
87 {
21
bb7dfb42b320 Small refactor to object placement. Add spawn point object
Michael Pavone <pavone@retrodev.com>
parents: 20
diff changeset
88 place_object(EMPTY, cursor_x, cursor_y);
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
89 }
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
90 }
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
91 if (went_down & BUTTON_START)
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
92 {
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
93 running = 1;
13
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
94 }
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
95 }
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
96
2
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97 int main(void)
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
98 {
13
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
99 JOY_init();
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
100 JOY_setEventHandler(&joy_event_handler);
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
101
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
102 u8 cursor_tile_index = 1;
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
103 VDP_loadTileData((const u32 *)cursor_tiles, cursor_tile_index, 4, 0);
10
889227ec630c cursor and input code added.
William Morgan <bill@mrgn.org>
parents: 7
diff changeset
104
4
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
105 u16 i;
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
106 VDP_setPlanSize(64, 32);
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
107 /*for (i = 6; i < 40*28; i += 4)
4
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
108 if ((i > 80 || i & 4) && (i < 40*26 || !(i & 4)) && i % 40 < 38)
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
109 {
17
ea345aa9cc30 using new tile constants
William Morgan <bill@mrgn.org>
parents: 15
diff changeset
110 tilemap[i] = WALL;
ea345aa9cc30 using new tile constants
William Morgan <bill@mrgn.org>
parents: 15
diff changeset
111 tilemap[i+1] = WALL;
4
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
112 }
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
113 */
21
bb7dfb42b320 Small refactor to object placement. Add spawn point object
Michael Pavone <pavone@retrodev.com>
parents: 20
diff changeset
114 place_object(GOAL, 38, 14);
bb7dfb42b320 Small refactor to object placement. Add spawn point object
Michael Pavone <pavone@retrodev.com>
parents: 20
diff changeset
115 place_object(SPAWN, 0, 14);
bb7dfb42b320 Small refactor to object placement. Add spawn point object
Michael Pavone <pavone@retrodev.com>
parents: 20
diff changeset
116 gen_distances(38, 14);
13
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
117 for (i = 0; i < MAX_SPRITE; i++)
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
118 {
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
119 spriteDefCache[i].posx = -0x80;
d118fe8fb1db Make cursor and creeps play nice
Mike Pavone <pavone@retrodev.com>
parents: 12
diff changeset
120 }
11
c0bb53eaa6f4 Calculate distances from goal for all passible points for pathfinding purposes
Mike Pavone <pavone@retrodev.com>
parents: 7
diff changeset
121 //print_distances();
2
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
122 for (;;)
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
123 {
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
124 VDP_waitVSync();
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
125 VDP_updateSprites();
23
330e58fb01aa simple object selection
William Morgan <bill@mrgn.org>
parents: 22
diff changeset
126 if ((getTick() % CURSOR_BLINK_RATE) == 0 && !running) {
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
127 VDP_setTileMap(VDP_PLAN_A, tileinfo[cursor_selection][0], cursor_x, cursor_y);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
128 VDP_setTileMap(VDP_PLAN_A, tileinfo[cursor_selection][1], cursor_x + 1, cursor_y);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
129 VDP_setTileMap(VDP_PLAN_A, tileinfo[cursor_selection][2], cursor_x, cursor_y + 1);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
130 VDP_setTileMap(VDP_PLAN_A, tileinfo[cursor_selection][3], cursor_x + 1, cursor_y + 1);
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
131 }
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
132 if ((getTick() % CURSOR_BLINK_RATE) == CURSOR_BLINK_RATE >> 1) {
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
133 clear_cursor();
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
134 }
4
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
135 for (i = 0; i < 28; i++)
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
136 {
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
137 VDP_setTileMapRectByIndex(VDP_PLAN_B, tilemap + i*40, i*64, 40, 0);
d73f53857e5f Add placeholder walls and goal
Mike Pavone <pavone@retrodev.com>
parents: 2
diff changeset
138 }
22
b725a715b358 cursor now blinks the current selection
William Morgan <bill@mrgn.org>
parents: 21
diff changeset
139 VDP_setSprite(0, cursor_x * PIXELS_PER_TILE, cursor_y * PIXELS_PER_TILE, SPRITE_SIZE(2,2), TILE_ATTR_FULL(PAL0, 1, 0, 0, cursor_tile_index), spriteDefCache[0].link);
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
140 if (running)
7
3ed112d64b1b Added basic creep spawning code
Mike Pavone <pavone@retrodev.com>
parents: 4
diff changeset
141 {
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
142 if (countdown)
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
143 --countdown;
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
144 else if (cur_creeps < 4)
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
145 {
21
bb7dfb42b320 Small refactor to object placement. Add spawn point object
Michael Pavone <pavone@retrodev.com>
parents: 20
diff changeset
146 spawn_creep(CREEP_NORMAL, 0+4, 14*8+4);
16
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
147 countdown = 300;
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
148 }
a9500e8bff93 Wait to spawn creeps until player hits start. Prevent player from placing walls in such a way to completely block creeps from goal. Remove placeholder walls.
Mike Pavone <pavone@retrodev.com>
parents: 15
diff changeset
149 update_creeps();
7
3ed112d64b1b Added basic creep spawning code
Mike Pavone <pavone@retrodev.com>
parents: 4
diff changeset
150 }
2
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
151 }
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
152 return 0;
8f23be2db808 Movec creep.h into the src folder. Added main loop
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
153 }