Skip to content
Snippets Groups Projects
Commit 68b53ddf authored by antoinemeyer5's avatar antoinemeyer5
Browse files

Merge branch 'main' of github.com:maberet/ProjetZZ1 into main

parents e3eb1e33 3f8041c2
No related branches found
No related tags found
No related merge requests found
#include "monstre.h"
#include "player.h"
monster_t monster;
int markov[SIZEMARKOV][SIZEMARKOV];
void initMonster (){
srand(time(NULL));
monster.x= (rand()%((MAP_WIDTH-3)/2)+16)*BLOCK_SIZE;
monster.y= (rand()%(MAP_HEIGHT-2))*BLOCK_SIZE;
monster.state= PEACEFULL;
monster.healthPoint= 3;
monster.speed=1;
monster.angle=0;
//monster.dammage
}
void readMarkovFromFile(char * filename){
FILE * fp;
int i, j;
fp = fopen(filename, "r");
if(fp == NULL){
printf("Error opening file\n");
exit(1);
}
for(i = 0; i < SIZEMARKOV; i++){
for(j = 0; j < SIZEMARKOV; j++){
fscanf(fp, "%d", &markov[i][j]);
}
}
fclose(fp);
}
#ifndef MONSTRE_H
#define MONSTRE_H
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include "map.h"
#define ANGRY 1
#define PEACEFULL 0
#define SIZEMARKOV 4
typedef enum {
false,true
}booleen_t;
typedef struct monster {
int x ;
int y;
int healthPoint;
int stateMarkov;
int state;
int speed;
float angle;
}monster_t;
extern monster_t monster;
void initMonster ();
void readMarkovFromFile(char * filename);
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment