back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/field.c
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-04-12 03:17:46 +0300
committerscratko <m@scratko.xyz>2024-04-12 03:17:46 +0300
commit04a6703fd66a7d34b2556a9c203c4dada3baca38 (patch)
tree3d2cbdaae515d90747e507ba8a8ebfd7bdc44fed /field.c
parent235f8481502263fcdb4823ff0bc4e8f831bc934d (diff)
downloadpacman-04a6703fd66a7d34b2556a9c203c4dada3baca38.tar.gz
pacman-04a6703fd66a7d34b2556a9c203c4dada3baca38.tar.bz2
pacman-04a6703fd66a7d34b2556a9c203c4dada3baca38.zip
Added behavior modes
Reverse direction Random direction
Diffstat (limited to 'field.c')
-rw-r--r--field.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/field.c b/field.c
index add43d1..37a5be1 100644
--- a/field.c
+++ b/field.c
@@ -8,7 +8,7 @@ static const char field_sample[field_height][field_width] = {
{"////////////////////////////"},
{"/1....2.....1//1.....2....1/"},
{"/.////./////.//./////.////./"},
- {"/./ /./ /.//./ /./ /./"},
+ {"/*/ /./ /.//./ /./ /*/"},
{"/./ /./ /.//./ /./ /./"},
{"/.////./////.//./////.////./"},
{"/2....3..2..2..2..2..3....2/"},
@@ -26,7 +26,7 @@ static const char field_sample[field_height][field_width] = {
{"//////.// //////// //.//////"},
{"/1....3..2..1//1..2..3....1/"},
{"/.////./////.//./////.////./"},
- {"/.////./////.//./////.////./"},
+ {"/*////./////.//./////.////*/"},
{"/1.1//2..2..y..y..2..2//1.1/"},
{"///.//.//.////////.//.//.///"},
{"///.//.//.////////.//.//.///"},
@@ -70,21 +70,24 @@ void print_field(game_space field)
symbol = field[i][j];
move(i, j);
switch(symbol) {
- case '1':
- case '2':
- case '3':
+ case one_path:
+ case two_paths:
+ case three_paths:
if(field_has_coin(i, j))
addch('.');
else
addch(' ');
break;
- case '/':
+ case block:
addch('/');
break;
- case '.':
+ case coin:
addch('.');
break;
- case '#':
+ case energizer:
+ addch('*');
+ break;
+ case door:
addch('#');
break;
}
@@ -138,6 +141,7 @@ void clear_or_revert_symbol(game_space field, struct coordinates position,
case door:
addch('#');
break;
+ case energizer:
case coin:
queue_consists_point(eaten_coins, position) ?
addch(' ') : addch('.');