Log hits, kills and misses
This commit is contained in:
parent
2899bb76f1
commit
ca7249e954
|
@ -45,7 +45,7 @@ before_build:
|
||||||
%DEPENDS% copy SDL2_ttf-2.0.14\%ARCH%\bin\*.dll %PREFIX%\lib > nul
|
%DEPENDS% copy SDL2_ttf-2.0.14\%ARCH%\bin\*.dll %PREFIX%\lib > nul
|
||||||
|
|
||||||
# Lua
|
# Lua
|
||||||
- ps: (new-object System.Net.WebClient).Downloadfile("https://sourceforge.net/projects/luabinaries/files/5.3.4/Windows%20Libraries/Static/lua-5.3.4_Win32_vc14_lib.zip/download", "c:\lua\lua-5.3.4_Win32_vc14_lib.zip")
|
- ps: (New-Object Net.WebClient).DownloadFile("https://sourceforge.net/projects/luabinaries/files/5.3.4/Windows%20Libraries/Static/lua-5.3.4_Win32_vc14_lib.zip/download", "c:\lua\lua-5.3.4_Win32_vc14_lib.zip")
|
||||||
- |-
|
- |-
|
||||||
%DEPENDS% 7z x "c:\lua\lua-5.3.4_Win32_vc14_lib.zip" -o"c:\lua" > nul
|
%DEPENDS% 7z x "c:\lua\lua-5.3.4_Win32_vc14_lib.zip" -o"c:\lua" > nul
|
||||||
%DEPENDS% copy c:\lua\include\* %PREFIX%\include > nul
|
%DEPENDS% copy c:\lua\include\* %PREFIX%\include > nul
|
||||||
|
|
6
TODO.txt
6
TODO.txt
|
@ -8,8 +8,8 @@ x Move "clip" from texture to sprite
|
||||||
x Hitting enemies
|
x Hitting enemies
|
||||||
x Nicer enemy hits (Text textures, healthbars?)
|
x Nicer enemy hits (Text textures, healthbars?)
|
||||||
- This could need some love later on.
|
- This could need some love later on.
|
||||||
- Add hits to stats
|
x Add hits to stats
|
||||||
- Player hits
|
x Player hits
|
||||||
x Moving enemies
|
x Moving enemies
|
||||||
x Stupid roaming enemies
|
x Stupid roaming enemies
|
||||||
x Smart agressive enemies
|
x Smart agressive enemies
|
||||||
|
@ -20,6 +20,8 @@ x Moving enemies
|
||||||
o XP
|
o XP
|
||||||
- Some xp amount logic
|
- Some xp amount logic
|
||||||
- Level threshholds
|
- Level threshholds
|
||||||
|
- Statistics
|
||||||
|
- More stuff to count
|
||||||
- gui
|
- gui
|
||||||
- Items
|
- Items
|
||||||
- More gui
|
- More gui
|
||||||
|
|
24
src/player.c
24
src/player.c
|
@ -31,8 +31,14 @@ has_collided(Player *player, RoomMatrix *matrix)
|
||||||
&space->monster->stats);
|
&space->monster->stats);
|
||||||
monster_hit(space->monster, hit);
|
monster_hit(space->monster, hit);
|
||||||
|
|
||||||
|
if (hit > 0)
|
||||||
|
player->hits += 1;
|
||||||
|
else
|
||||||
|
player->misses += 1;
|
||||||
|
|
||||||
if (space->monster->stats.hp <= 0) {
|
if (space->monster->stats.hp <= 0) {
|
||||||
// TODO(Linus): This needs some love later on.
|
// TODO(Linus): This needs some love later on.
|
||||||
|
player->kills += 1;
|
||||||
player->xp += 10;
|
player->xp += 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,9 +154,12 @@ player_create(class_t class, SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
Player *player = malloc(sizeof(Player));
|
Player *player = malloc(sizeof(Player));
|
||||||
player->sprite = sprite_create();
|
player->sprite = sprite_create();
|
||||||
player->total_steps = 0;
|
player->total_steps = 0;
|
||||||
player->steps = 0;
|
player->steps = 0;
|
||||||
player->xp = 0;
|
player->xp = 0;
|
||||||
|
player->hits = 0;
|
||||||
|
player->kills = 0;
|
||||||
|
player->misses = 0;
|
||||||
|
|
||||||
char asset[100];
|
char asset[100];
|
||||||
switch (class) {
|
switch (class) {
|
||||||
|
@ -216,10 +225,13 @@ player_print(Player *p)
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("--------=== <[ Player Stats ]> ===--------\n");
|
printf("--------=== <[ Player Stats ]> ===--------\n");
|
||||||
printf("HP: %d\n", p->stats.hp);
|
printf("HP: %d\n", p->stats.hp);
|
||||||
printf("Level: %u XP: %u\n", p->stats.lvl, p->xp);
|
printf("Level: %u\tXP:\t%u\n", p->stats.lvl, p->xp);
|
||||||
printf("Pos: %dx%d RoomPos: %dx%d\n", pos.x, pos.y, roomPos.x, roomPos.y);
|
printf("Hits: %u\tMisses:\t%u\n", p->hits, p->misses);
|
||||||
|
printf("Kills: %u\n", p->kills);
|
||||||
printf("Steps: %u\n", p->total_steps);
|
printf("Steps: %u\n", p->total_steps);
|
||||||
|
printf("Pos: %dx%d\tRoomPos: %dx%d\n", pos.x, pos.y,
|
||||||
|
roomPos.x, roomPos.y);
|
||||||
printf("------------------------------------------\n");
|
printf("------------------------------------------\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ typedef struct Player_t {
|
||||||
unsigned int xp;
|
unsigned int xp;
|
||||||
unsigned int total_steps;
|
unsigned int total_steps;
|
||||||
unsigned int steps;
|
unsigned int steps;
|
||||||
|
unsigned int hits;
|
||||||
|
unsigned int kills;
|
||||||
|
unsigned int misses;
|
||||||
void (*handle_event)(struct Player_t*, RoomMatrix*, SDL_Event*);
|
void (*handle_event)(struct Player_t*, RoomMatrix*, SDL_Event*);
|
||||||
} Player;
|
} Player;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue