diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/monstre.c b/travail_de_groupe/jeu_appren_par_renfo/src/monstre.c new file mode 100644 index 0000000000000000000000000000000000000000..3b720cc80a1c7fc3ceebb85eb499d7f7bd3575a0 --- /dev/null +++ b/travail_de_groupe/jeu_appren_par_renfo/src/monstre.c @@ -0,0 +1,32 @@ +#include "monster.h" + +monster_t monster; +int markov[SIZEMARKOV][SIZEMARKOV]; + +void initMonster (){ + + 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; + //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); +} diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/monstre.h b/travail_de_groupe/jeu_appren_par_renfo/src/monstre.h new file mode 100644 index 0000000000000000000000000000000000000000..7289b6413be46200610617a0a76314d811dbb695 --- /dev/null +++ b/travail_de_groupe/jeu_appren_par_renfo/src/monstre.h @@ -0,0 +1,32 @@ +#ifndef MONSTER_H +#define MONSTER_H + +#include <stdlib.h> +#include <time.h> +#include <stdio.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 diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/player.c b/travail_de_groupe/jeu_appren_par_renfo/src/player.c new file mode 100644 index 0000000000000000000000000000000000000000..bc2c520c5e1a8714dad8dda10608bf954b18b198 --- /dev/null +++ b/travail_de_groupe/jeu_appren_par_renfo/src/player.c @@ -0,0 +1,14 @@ +#include "player.h" + +player_t player; + +void initPlayer(){ + player.x= 8*CELLSIZE; + player.y= 8*CELLSIZE; + player.speed = 1; + player.isMoving = 0; + player.HPMax = 3; + player.currentHP = player.HPMax; + player.coins = 0; + player.angle=0; +} \ No newline at end of file diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/player.h b/travail_de_groupe/jeu_appren_par_renfo/src/player.h new file mode 100644 index 0000000000000000000000000000000000000000..e9622b47138f5e569b06c4728a38ce7a9c6c979b --- /dev/null +++ b/travail_de_groupe/jeu_appren_par_renfo/src/player.h @@ -0,0 +1,25 @@ +#ifndef PLAYER_H +#define PLAYER_H + +#define PLAYER_UP 0 +#define PLAYER_DOWN 1 +#define PLAYER_LEFT 2 +#define PLAYER_RIGHT 3 + +typedef struct player{ + int x; + int y; + int speed; + int isMoving; + int direction; + int HPMax; + int currentHP; + int coins; + float angle; +} player_t; + +extern player_t player; + +void initPlayer(); + +#endif \ No newline at end of file