SnakeEffect now turns into a random direction when hitting a wall. The code is now also a whole lot cleaner.
This commit is contained in:
@ -7,11 +7,17 @@
|
||||
class SnakeEffect : public Effect {
|
||||
private:
|
||||
Coords coords;
|
||||
uint8_t direction;
|
||||
uint8_t hue;
|
||||
uint8_t run;
|
||||
uint8_t direction = 1;
|
||||
uint8_t hue = 0;
|
||||
uint8_t run = 0;
|
||||
Window window = {0, 0, LED_WIDTH, LED_HEIGHT-6};
|
||||
bool is_turn_needed();
|
||||
void turn_random();
|
||||
bool turn_right();
|
||||
bool turn_left();
|
||||
bool is_direction_okay(uint8_t direction);
|
||||
public:
|
||||
SnakeEffect();
|
||||
void loop();
|
||||
boolean valid_position(Coords c);
|
||||
Coords update_position(Coords c, uint8_t direction);
|
||||
|
Reference in New Issue
Block a user