2019-09-25 16:11:03 +00:00
|
|
|
#pragma once
|
2019-05-31 03:45:07 +00:00
|
|
|
|
|
|
|
#include "Effect.h"
|
|
|
|
#include "prototypes.h"
|
|
|
|
|
|
|
|
class SnakeEffect : public Effect {
|
|
|
|
private:
|
|
|
|
Coords coords;
|
2019-06-04 03:57:27 +00:00
|
|
|
uint8_t direction = 1;
|
|
|
|
uint8_t hue = 0;
|
|
|
|
uint8_t run = 0;
|
|
|
|
bool is_turn_needed();
|
|
|
|
void turn_random();
|
|
|
|
bool turn_right();
|
|
|
|
bool turn_left();
|
|
|
|
bool is_direction_okay(uint8_t direction);
|
2019-05-31 03:45:07 +00:00
|
|
|
public:
|
2019-06-04 03:57:27 +00:00
|
|
|
SnakeEffect();
|
2019-06-19 20:23:49 +00:00
|
|
|
~SnakeEffect();
|
2019-10-01 04:29:32 +00:00
|
|
|
void loop(uint16_t ms);
|
2019-05-31 03:45:07 +00:00
|
|
|
boolean valid_position(Coords c);
|
|
|
|
Coords update_position(Coords c, uint8_t direction);
|
|
|
|
boolean can_be_shown_with_clock();
|
2019-09-25 16:11:03 +00:00
|
|
|
String get_name() override { return "snake"; }
|
2019-05-31 03:45:07 +00:00
|
|
|
};
|