Skip to content
Snippets Groups Projects
Commit 36d7000e authored by maberet's avatar maberet
Browse files

Modification des noms de variables

parent e5be3799
Branches
No related tags found
No related merge requests found
#include "monster.h"
#include "monstre.h"
#include "player.h"
monster_t monster;
int markov[SIZEMARKOV][SIZEMARKOV];
void initMonster (){
srand(time(NULL));
monster.x= (rand()%((MAPSIZEX-3)/2)+16)*CELLSIZE;
monster.y= (rand()%(MAPSIZEY-2))*CELLSIZE;
monster.state= PEACEFULL;
monster.healthPoint= 3;
monster.speed=1;
monster.angle=0;
monter.angle=0;
//monster.dammage
}
......@@ -30,3 +33,32 @@ void readMarkovFromFile(char * filename){
}
fclose(fp);
}
void moveMonsterPeacefull(int markov){
srand(time(NULL));
probability= rand()%100;
state=monster.stateMarkov;
pDead=markov[state][ENTITIES_UP];
pSparkle=(markov[state][ENTITIES_UP]+markov[state][ENTITIES_DOWN]);
pMedium=(markov[state][ENTITIES_UP]+markov[state][ENTITIES_DOWN]+markov[state][ENTITIES_LEFT]);
pStrong=pMedium+markov[state][ENTITIES_RIGHT]);
if ((0<=probability)&&(probability<pDead)){(listTemporary->fire).state=DEAD;}
else if ((pDead<=probability)&&(probability<pSparkle)){(listTemporary->fire).state=SPARKLE;}
else if ((pSparkle<=probability)&&(probability<pMedium)){(listTemporary->fire).state=MEDIUM;}
else if ((pMedium<=probability)&&(probability<pStrong)){(listTemporary->fire).state=STRONG;}
else {(listTemporary->fire).state=SPREAD;}
}
void moveMonsterAngry()
\ No newline at end of file
#ifndef MONSTER_H
#define MONSTER_H
#ifndef MONSTRE_H
#define MONSTRE_H
#include <stdlib.h>
#include <time.h>
......@@ -25,7 +25,7 @@ typedef struct monster {
extern monster_t monster;
void initMonster ()
void initMonster ();
void readMarkovFromFile(char * filename);
......
......@@ -3,8 +3,8 @@
player_t player;
void initPlayer(){
player.x= 8*CELLSIZE;
player.y= 8*CELLSIZE;
player.x= 8*BLOCK_SIZE;
player.y= 8*BLOCK_SIZE;
player.speed = 1;
player.isMoving = 0;
player.HPMax = 3;
......
#ifndef PLAYER_H
#define PLAYER_H
#define PLAYER_UP 0
#define PLAYER_DOWN 1
#define PLAYER_LEFT 2
#define PLAYER_RIGHT 3
#define ENTITIES_UP 0
#define ENTITIES_DOWN 1
#define ENTITIES_LEFT 2
#define ENTITIES_RIGHT 3
typedef struct player{
int x;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment