Skip to content
Snippets Groups Projects
Commit af9a1810 authored by belkhiritaha's avatar belkhiritaha
Browse files

player movement working

parent f26b6491
Branches
No related tags found
No related merge requests found
No preview for this file type
......@@ -82,6 +82,7 @@ void gestMenu(){
continue;
}
}
GestMovement();
SDL_Delay(5);
}
......
......@@ -2,6 +2,7 @@
#define PLAYER_H
#include "main.h"
#include "gest_event.h"
typedef struct Player{
int x;
......@@ -12,5 +13,6 @@ typedef struct Player{
extern Player_t player;
void initPlayer();
void GestMovement();
#endif
\ No newline at end of file
......@@ -77,8 +77,8 @@ void drawPlayer(){
SDL_Rect rect;
rect.h = CELLSIZE;
rect.w = CELLSIZE;
rect.x = player.x * CELLSIZE + (ScreenDimension.w - (MAPSIZE * CELLSIZE)) / 2;
rect.y = player.y * CELLSIZE;
rect.x = player.x + (ScreenDimension.w - (MAPSIZE * CELLSIZE)) / 2;
rect.y = player.y ;
SDL_Rect destRect = {32 * (SDL_GetTicks()/200%4), 0, 32, 32};
SDL_RenderCopyEx(renderer, playerTexture, &destRect, &rect, 0, NULL, SDL_FLIP_NONE);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment