- [NEW] Módul "info"retocat

This commit is contained in:
2025-07-02 17:15:49 +02:00
parent d7c965ff0b
commit 83cf446c37
17 changed files with 134 additions and 136 deletions

View File

@@ -2,8 +2,7 @@
#include "jgame.h"
#include <stdlib.h>
Bola::Bola( JD8_Surface gfx, Info* info, Prota* sam ) : Sprite( gfx ) {
this->info = info;
Bola::Bola( JD8_Surface gfx, Prota* sam ) : Sprite( gfx ) {
this->sam = sam;
this->entitat = (Entitat*)malloc( sizeof( Entitat ) );
@@ -58,8 +57,8 @@ void Bola::update() {
// 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;
this->info->vida--;
if( this->info->vida == 0 ) this->sam->o = 5;
info::vida--;
if( info::vida == 0 ) this->sam->o = 5;
}
} else {
this->contador--;