tidy-fix automàtic (sense naming)
This commit is contained in:
+16
-6
@@ -1,6 +1,6 @@
|
||||
#include "game/bola.hpp"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "core/jail/jgame.hpp"
|
||||
|
||||
@@ -24,29 +24,39 @@ Bola::Bola(JD8_Surface gfx, Prota* sam)
|
||||
}
|
||||
|
||||
void Bola::draw() {
|
||||
if (this->contador == 0) Sprite::draw();
|
||||
if (this->contador == 0) {
|
||||
Sprite::draw();
|
||||
}
|
||||
}
|
||||
|
||||
void Bola::update() {
|
||||
if (this->contador == 0) {
|
||||
// Augmentem la x
|
||||
this->x++;
|
||||
if (this->x == 280) this->contador = 200;
|
||||
if (this->x == 280) {
|
||||
this->contador = 200;
|
||||
}
|
||||
|
||||
// Augmentem el frame
|
||||
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;
|
||||
if (this->cur_frame == entitat.animacions[this->o].frames.size()) {
|
||||
this->cur_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Comprovem si ha tocat a Sam
|
||||
if (this->x > (this->sam->x - 7) && this->x < (this->sam->x + 7) && this->y > (this->sam->y - 7) && this->y < (this->sam->y + 7)) {
|
||||
this->contador = 200;
|
||||
info::ctx.vida--;
|
||||
if (info::ctx.vida == 0) this->sam->o = 5;
|
||||
if (info::ctx.vida == 0) {
|
||||
this->sam->o = 5;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this->contador--;
|
||||
if (this->contador == 0) this->x = 20;
|
||||
if (this->contador == 0) {
|
||||
this->x = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user