diff --git a/travail_de_groupe/jeu_appren_par_renfo/map.txt b/travail_de_groupe/jeu_appren_par_renfo/map.txt index d5439ec567915a31da80250987d35294005debe3..9fe61816ae2fd2cd72041823d5474538c6e2600a 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/map.txt +++ b/travail_de_groupe/jeu_appren_par_renfo/map.txt @@ -7,11 +7,4 @@ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \ No newline at end of file diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/ball.c b/travail_de_groupe/jeu_appren_par_renfo/src/ball.c index 53710e598da40cd7b528119e74eaa91d78fd7de4..5c73891b50def542e68ea0d99a4605d9871effb2 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/src/ball.c +++ b/travail_de_groupe/jeu_appren_par_renfo/src/ball.c @@ -1,10 +1,19 @@ #include "ball.h" -//ball_t ball; +ball_t ball; int trajectoireAntoine[NUMBERPOINT_TRAJEC][2]; void initBall() { + ball.x = 5 * BLOCK_SIZE; + ball.y = 5 * BLOCK_SIZE; + ball.z = player.h/BLOCK_SIZE; + ball.h = 0.5 * BLOCK_SIZE; + ball.w = 0.5 * BLOCK_SIZE; + ball.isHit = 0; + ball.angle = -pi; + ball.speed = 0; + } float defineAngle(int canonX, int canonY, int xDropPoint, int yDropPoint) diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/ball.h b/travail_de_groupe/jeu_appren_par_renfo/src/ball.h index ded489c8856f6ab4220ab7d62587a28edce58538..2f22f9a567d89511f581ef1eba2db832f0666554 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/src/ball.h +++ b/travail_de_groupe/jeu_appren_par_renfo/src/ball.h @@ -6,6 +6,8 @@ #include <stdio.h> #include <math.h> +#include "render.h" + #define NUMBERPOINT_TRAJEC 50 typedef enum @@ -16,14 +18,17 @@ typedef enum typedef struct ball { - int x; - int y; - int z; + float x; + float y; + float z; + int h; + int w; + int isHit; float angle; - float speed; + int speed; } ball_t; -//extern ball_t ball; +extern ball_t ball; extern int trajectoireAntoine[NUMBERPOINT_TRAJEC][2]; void initBall(); diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/main.c b/travail_de_groupe/jeu_appren_par_renfo/src/main.c index 37ab94803c41d82953c7ea3e7f2f57246d7df6f7..6a04d466e4b3c6e5a6b49b1e49a3eb6b9e2b4268 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/src/main.c +++ b/travail_de_groupe/jeu_appren_par_renfo/src/main.c @@ -14,6 +14,7 @@ int main(){ //printMap(); initPlayer(); initKeys(); + initBall(); mainLoop(); diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/map.h b/travail_de_groupe/jeu_appren_par_renfo/src/map.h index 0ba0db56a73b8c5e2dd6500593b1549f72609cca..13c7cf8bc4996d7009095775e2211542cfd65918 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/src/map.h +++ b/travail_de_groupe/jeu_appren_par_renfo/src/map.h @@ -5,7 +5,7 @@ #define MAP_WIDTH 31 -#define MAP_HEIGHT 17 +#define MAP_HEIGHT 10 extern int map[MAP_HEIGHT][MAP_WIDTH]; diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/player.c b/travail_de_groupe/jeu_appren_par_renfo/src/player.c index 700361f8f4f35165371f5e0f648274cf37c9f66a..63dd7976691b6649b2e2598d4b2041c04ffc206d 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/src/player.c +++ b/travail_de_groupe/jeu_appren_par_renfo/src/player.c @@ -1,30 +1,23 @@ #include "player.h" player_t player; - player_t ennemy; -player_t ball; - int *landingPoint; int *lastHitPoint; void initPlayer() { - player.x = 6 * BLOCK_SIZE; - player.y = 6 * BLOCK_SIZE; + player.x = 3 * BLOCK_SIZE; + player.y = 5 * BLOCK_SIZE; player.h = 2 * BLOCK_SIZE; player.w = 2 * BLOCK_SIZE; player.angle = 0; ennemy.h = 2 * BLOCK_SIZE; ennemy.w = 2 * BLOCK_SIZE; - ennemy.x = 20 * BLOCK_SIZE; - ennemy.y = 10 * BLOCK_SIZE; + ennemy.x = 25 * BLOCK_SIZE; + ennemy.y = 5 * BLOCK_SIZE; ennemy.angle = -pi; - ball.h = 0.5 * BLOCK_SIZE; - ball.w = 0.5 * BLOCK_SIZE; - ball.x = 10 * BLOCK_SIZE; - ball.y = 10 * BLOCK_SIZE; player.speed = 1; player.isMoving = 0; player.HPMax = 3; @@ -34,10 +27,6 @@ void initPlayer() player.deltax = 1; player.deltay = 0; player.viewAngle = 0; - ball.z = player.h/BLOCK_SIZE; - ball.isHit = 0; - ball.speed = 0; - ball.angle = -pi; } int *generateLandingPoint() diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/player.h b/travail_de_groupe/jeu_appren_par_renfo/src/player.h index 11c624bd391ac2f8d281f06f7320a2b2ef3f0bdf..6e59c1a489cadfaab490e8b1259479c42048ec11 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/src/player.h +++ b/travail_de_groupe/jeu_appren_par_renfo/src/player.h @@ -36,7 +36,6 @@ typedef struct player{ extern player_t player; extern player_t ennemy; -extern player_t ball; void initPlayer(); void managePlayer();