26 lines
539 B
C++
26 lines
539 B
C++
#pragma once
|
|
|
|
#include "Effect.h"
|
|
#include "prototypes.h"
|
|
|
|
class SnakeEffect : public Effect {
|
|
private:
|
|
Coords coords;
|
|
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);
|
|
public:
|
|
SnakeEffect();
|
|
~SnakeEffect();
|
|
void loop();
|
|
boolean valid_position(Coords c);
|
|
Coords update_position(Coords c, uint8_t direction);
|
|
boolean can_be_shown_with_clock();
|
|
String get_name() override { return "snake"; }
|
|
};
|