refactor: extreure helpers per reduir complexitat cognitiva (tidy net)
This commit is contained in:
@@ -22,25 +22,25 @@ Engendro::Engendro(Jd8::Surface gfx, Uint16 x, Uint16 y)
|
||||
entitat.animacions[0].frames = {0, 1, 2, 3, 2, 1};
|
||||
|
||||
this->cur_frame = 0;
|
||||
this->vida = 18;
|
||||
this->vida_ = 18;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->o = 0;
|
||||
this->cycles_per_frame = 30;
|
||||
this->cycles_per_frame_ = 30;
|
||||
}
|
||||
|
||||
auto Engendro::update() -> bool {
|
||||
bool mort = false;
|
||||
|
||||
if (Jg::getCycleCounter() % this->cycles_per_frame == 0) {
|
||||
if (Jg::getCycleCounter() % this->cycles_per_frame_ == 0) {
|
||||
this->cur_frame++;
|
||||
if (this->cur_frame == entitat.animacions[this->o].frames.size()) {
|
||||
this->cur_frame = 0;
|
||||
}
|
||||
this->vida--;
|
||||
this->vida_--;
|
||||
}
|
||||
|
||||
if (vida == 0) {
|
||||
if (vida_ == 0) {
|
||||
mort = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user