From 1332ef8ad56b00ac314bc40961f23c9bc905dcf7 Mon Sep 17 00:00:00 2001 From: Michael Hayes Date: Tue, 1 Oct 2013 15:16:39 +1300 Subject: [PATCH] Make monster flash --- apps/gobble6/gobble6.c | 6 ++++++ apps/gobble6/things.c | 7 +++++++ apps/gobble6/things.h | 10 ++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/gobble6/gobble6.c b/apps/gobble6/gobble6.c index 74d7087..e298b90 100644 --- a/apps/gobble6/gobble6.c +++ b/apps/gobble6/gobble6.c @@ -61,6 +61,12 @@ int main (void) navswitch_tick++; if (navswitch_tick >= LOOP_RATE / NAVSWITCH_RATE) { + static int count = 0; + + count++; + if (running && count % 4 == 0) + monster_toggle (); + navswitch_tick = 0; navswitch_update (); diff --git a/apps/gobble6/things.c b/apps/gobble6/things.c index 44b0798..68edfed 100644 --- a/apps/gobble6/things.c +++ b/apps/gobble6/things.c @@ -98,6 +98,13 @@ void monster_move (int8_t dx, int8_t dy) } +void monster_toggle (void) +{ + tinygl_pixel_set (things[0].pos, ! tinygl_pixel_get (things[0].pos)); +} + + + static void thing_move (uint8_t this) { uint8_t i; diff --git a/apps/gobble6/things.h b/apps/gobble6/things.h index d644780..8b83a46 100644 --- a/apps/gobble6/things.h +++ b/apps/gobble6/things.h @@ -3,16 +3,14 @@ #include "system.h" -void things_create (void); - -void things_twinkle (void); +bool things_killed_p (void); -void things_display (uint8_t tick); +void things_create (void); -bool things_killed_p (void); +void things_move (void); void monster_move (int8_t dx, int8_t dy); -void things_move (void); +void monster_toggle (void); #endif