Browse Source

the paddle moves twice as fast if you press the fire button

feature/2015
Christian Kroll 14 years ago
parent
commit
2dadcb1d0b
  1. 15
      games/breakout/breakout.c
  2. 2
      games/breakout/config.h

15
games/breakout/breakout.c

@ -59,17 +59,18 @@ void borg_breakout(uint8_t demomode)
ball_spawn_default(&(balls[0])); ball_spawn_default(&(balls[0]));
balls[0].strength = START_LIFES; balls[0].strength = START_LIFES;
level_init(level); level_init(level);
uint8_t tick_divider = 0;
rebound_init(); rebound_init();
while (cycles != 0) while (cycles != 0)
{ {
wait(50); wait(25);
if (demomode) if ((tick_divider % 2) || JOYISFIRE)
rebound_tick(&balls[0]); rebound_tick(demomode ? &balls[0] : NULL);
else
rebound_tick(NULL);
if (tick_divider % 2)
{
ball_think(&(balls[0])); ball_think(&(balls[0]));
playfield_draw(); playfield_draw();
ball_draw(&(balls[0])); ball_draw(&(balls[0]));
@ -88,9 +89,13 @@ void borg_breakout(uint8_t demomode)
level_init(level); level_init(level);
rebound_init(); rebound_init();
} }
}
if (demomode) if (demomode)
--cycles; --cycles;
// alternate the value of the tick divider
tick_divider = tick_divider ? 0 : 1;
} }
ignorescore = ignorescore_buffer; ignorescore = ignorescore_buffer;

2
games/breakout/config.h

@ -30,7 +30,7 @@ static const int8_t rebound_reflection[6][2] =
{ 72, -20} /* offside right */ { 72, -20} /* offside right */
}; };
#define DEMO_CYCLES 1200; #define DEMO_CYCLES 2400;
#endif /* CONFIG_H */ #endif /* CONFIG_H */

Loading…
Cancel
Save