From f233cd4f15ea8145bb196a8a88dcb5a18944375b Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Tue, 2 Jan 2024 22:01:43 +0100 Subject: player colors --- .gitignore | 1 + .vscode/settings.json | 8 -------- build/zombies.exe | Bin 2109456 -> 2111357 bytes data/imgs/players/Black/Gunner_Black_Crouch.png | Bin 0 -> 1408 bytes data/imgs/players/Black/Gunner_Black_Death.png | Bin 0 -> 3342 bytes data/imgs/players/Black/Gunner_Black_Idle.png | Bin 0 -> 1543 bytes data/imgs/players/Black/Gunner_Black_Jump.png | Bin 0 -> 1065 bytes data/imgs/players/Black/Gunner_Black_Run.png | Bin 0 -> 2450 bytes data/imgs/players/Green/Gunner_Green_Crouch.png | Bin 0 -> 1479 bytes data/imgs/players/Green/Gunner_Green_Death.png | Bin 0 -> 3641 bytes data/imgs/players/Green/Gunner_Green_Idle.png | Bin 0 -> 1665 bytes data/imgs/players/Green/Gunner_Green_Jump.png | Bin 0 -> 1159 bytes data/imgs/players/Green/Gunner_Green_Run.png | Bin 0 -> 2518 bytes data/imgs/players/Red/Gunner_Red_Crouch.png | Bin 0 -> 1425 bytes data/imgs/players/Red/Gunner_Red_Death.png | Bin 0 -> 3474 bytes data/imgs/players/Red/Gunner_Red_Idle.png | Bin 0 -> 1502 bytes data/imgs/players/Red/Gunner_Red_Jump.png | Bin 0 -> 1109 bytes data/imgs/players/Red/Gunner_Red_Run.png | Bin 0 -> 2357 bytes data/imgs/players/Yellow/Gunner_Yellow_Crouch.png | Bin 0 -> 1529 bytes data/imgs/players/Yellow/Gunner_Yellow_Death.png | Bin 0 -> 3582 bytes data/imgs/players/Yellow/Gunner_Yellow_Idle.png | Bin 0 -> 1513 bytes data/imgs/players/Yellow/Gunner_Yellow_Jump.png | Bin 0 -> 1169 bytes data/imgs/players/Yellow/Gunner_Yellow_Run.png | Bin 0 -> 2314 bytes include/asset_defs.h | 13 +++++++++++++ include/game.h | 2 +- include/players.h | 2 +- libSDL2.a | Bin 21786444 -> 0 bytes libSDL2_mixer.a | Bin 1868194 -> 0 bytes src/asset_defs.c | 12 ++++++++++++ src/players.c | 13 ++++++++++++- 30 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 .gitignore delete mode 100644 .vscode/settings.json create mode 100644 data/imgs/players/Black/Gunner_Black_Crouch.png create mode 100644 data/imgs/players/Black/Gunner_Black_Death.png create mode 100644 data/imgs/players/Black/Gunner_Black_Idle.png create mode 100644 data/imgs/players/Black/Gunner_Black_Jump.png create mode 100644 data/imgs/players/Black/Gunner_Black_Run.png create mode 100644 data/imgs/players/Green/Gunner_Green_Crouch.png create mode 100644 data/imgs/players/Green/Gunner_Green_Death.png create mode 100644 data/imgs/players/Green/Gunner_Green_Idle.png create mode 100644 data/imgs/players/Green/Gunner_Green_Jump.png create mode 100644 data/imgs/players/Green/Gunner_Green_Run.png create mode 100644 data/imgs/players/Red/Gunner_Red_Crouch.png create mode 100644 data/imgs/players/Red/Gunner_Red_Death.png create mode 100644 data/imgs/players/Red/Gunner_Red_Idle.png create mode 100644 data/imgs/players/Red/Gunner_Red_Jump.png create mode 100644 data/imgs/players/Red/Gunner_Red_Run.png create mode 100644 data/imgs/players/Yellow/Gunner_Yellow_Crouch.png create mode 100644 data/imgs/players/Yellow/Gunner_Yellow_Death.png create mode 100644 data/imgs/players/Yellow/Gunner_Yellow_Idle.png create mode 100644 data/imgs/players/Yellow/Gunner_Yellow_Jump.png create mode 100644 data/imgs/players/Yellow/Gunner_Yellow_Run.png delete mode 100644 libSDL2.a delete mode 100644 libSDL2_mixer.a diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 7a89823..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files.associations": { - "*.ejs": "html", - "initializer_list": "c", - "type_traits": "c", - "xutility": "c" - } -} \ No newline at end of file diff --git a/build/zombies.exe b/build/zombies.exe index 7a62eac..4b57496 100644 Binary files a/build/zombies.exe and b/build/zombies.exe differ diff --git a/data/imgs/players/Black/Gunner_Black_Crouch.png b/data/imgs/players/Black/Gunner_Black_Crouch.png new file mode 100644 index 0000000..92493c3 Binary files /dev/null and b/data/imgs/players/Black/Gunner_Black_Crouch.png differ diff --git a/data/imgs/players/Black/Gunner_Black_Death.png b/data/imgs/players/Black/Gunner_Black_Death.png new file mode 100644 index 0000000..2be6095 Binary files /dev/null and b/data/imgs/players/Black/Gunner_Black_Death.png differ diff --git a/data/imgs/players/Black/Gunner_Black_Idle.png b/data/imgs/players/Black/Gunner_Black_Idle.png new file mode 100644 index 0000000..217a4a7 Binary files /dev/null and b/data/imgs/players/Black/Gunner_Black_Idle.png differ diff --git a/data/imgs/players/Black/Gunner_Black_Jump.png b/data/imgs/players/Black/Gunner_Black_Jump.png new file mode 100644 index 0000000..69fcd7c Binary files /dev/null and b/data/imgs/players/Black/Gunner_Black_Jump.png differ diff --git a/data/imgs/players/Black/Gunner_Black_Run.png b/data/imgs/players/Black/Gunner_Black_Run.png new file mode 100644 index 0000000..9c5b96f Binary files /dev/null and b/data/imgs/players/Black/Gunner_Black_Run.png differ diff --git a/data/imgs/players/Green/Gunner_Green_Crouch.png b/data/imgs/players/Green/Gunner_Green_Crouch.png new file mode 100644 index 0000000..29c8f98 Binary files /dev/null and b/data/imgs/players/Green/Gunner_Green_Crouch.png differ diff --git a/data/imgs/players/Green/Gunner_Green_Death.png b/data/imgs/players/Green/Gunner_Green_Death.png new file mode 100644 index 0000000..f979b1d Binary files /dev/null and b/data/imgs/players/Green/Gunner_Green_Death.png differ diff --git a/data/imgs/players/Green/Gunner_Green_Idle.png b/data/imgs/players/Green/Gunner_Green_Idle.png new file mode 100644 index 0000000..62c409e Binary files /dev/null and b/data/imgs/players/Green/Gunner_Green_Idle.png differ diff --git a/data/imgs/players/Green/Gunner_Green_Jump.png b/data/imgs/players/Green/Gunner_Green_Jump.png new file mode 100644 index 0000000..9e5e954 Binary files /dev/null and b/data/imgs/players/Green/Gunner_Green_Jump.png differ diff --git a/data/imgs/players/Green/Gunner_Green_Run.png b/data/imgs/players/Green/Gunner_Green_Run.png new file mode 100644 index 0000000..4d71311 Binary files /dev/null and b/data/imgs/players/Green/Gunner_Green_Run.png differ diff --git a/data/imgs/players/Red/Gunner_Red_Crouch.png b/data/imgs/players/Red/Gunner_Red_Crouch.png new file mode 100644 index 0000000..1fd9470 Binary files /dev/null and b/data/imgs/players/Red/Gunner_Red_Crouch.png differ diff --git a/data/imgs/players/Red/Gunner_Red_Death.png b/data/imgs/players/Red/Gunner_Red_Death.png new file mode 100644 index 0000000..0e1227b Binary files /dev/null and b/data/imgs/players/Red/Gunner_Red_Death.png differ diff --git a/data/imgs/players/Red/Gunner_Red_Idle.png b/data/imgs/players/Red/Gunner_Red_Idle.png new file mode 100644 index 0000000..993a2e2 Binary files /dev/null and b/data/imgs/players/Red/Gunner_Red_Idle.png differ diff --git a/data/imgs/players/Red/Gunner_Red_Jump.png b/data/imgs/players/Red/Gunner_Red_Jump.png new file mode 100644 index 0000000..35820eb Binary files /dev/null and b/data/imgs/players/Red/Gunner_Red_Jump.png differ diff --git a/data/imgs/players/Red/Gunner_Red_Run.png b/data/imgs/players/Red/Gunner_Red_Run.png new file mode 100644 index 0000000..d641ef1 Binary files /dev/null and b/data/imgs/players/Red/Gunner_Red_Run.png differ diff --git a/data/imgs/players/Yellow/Gunner_Yellow_Crouch.png b/data/imgs/players/Yellow/Gunner_Yellow_Crouch.png new file mode 100644 index 0000000..b90b937 Binary files /dev/null and b/data/imgs/players/Yellow/Gunner_Yellow_Crouch.png differ diff --git a/data/imgs/players/Yellow/Gunner_Yellow_Death.png b/data/imgs/players/Yellow/Gunner_Yellow_Death.png new file mode 100644 index 0000000..fa21a8e Binary files /dev/null and b/data/imgs/players/Yellow/Gunner_Yellow_Death.png differ diff --git a/data/imgs/players/Yellow/Gunner_Yellow_Idle.png b/data/imgs/players/Yellow/Gunner_Yellow_Idle.png new file mode 100644 index 0000000..bd4d31d Binary files /dev/null and b/data/imgs/players/Yellow/Gunner_Yellow_Idle.png differ diff --git a/data/imgs/players/Yellow/Gunner_Yellow_Jump.png b/data/imgs/players/Yellow/Gunner_Yellow_Jump.png new file mode 100644 index 0000000..ca6531e Binary files /dev/null and b/data/imgs/players/Yellow/Gunner_Yellow_Jump.png differ diff --git a/data/imgs/players/Yellow/Gunner_Yellow_Run.png b/data/imgs/players/Yellow/Gunner_Yellow_Run.png new file mode 100644 index 0000000..e6ee52d Binary files /dev/null and b/data/imgs/players/Yellow/Gunner_Yellow_Run.png differ diff --git a/include/asset_defs.h b/include/asset_defs.h index 417e890..192044b 100644 --- a/include/asset_defs.h +++ b/include/asset_defs.h @@ -46,6 +46,19 @@ image* img_molotov_explode; // Players image* img_gunner_blue_run; image* img_gunner_blue_idle; + +image* img_gunner_black_run; +image* img_gunner_black_idle; + +image* img_gunner_green_run; +image* img_gunner_green_idle; + +image* img_gunner_yellow_run; +image* img_gunner_yellow_idle; + +image* img_gunner_red_run; +image* img_gunner_red_idle; + image* img_alien_run; // Guns diff --git a/include/game.h b/include/game.h index 869d64c..60c170c 100644 --- a/include/game.h +++ b/include/game.h @@ -8,7 +8,7 @@ #include "../include/game.h" #define SERVER_TICK_RATE (1.0f/60.0f) -#define SERVER_MAX_PLAYERS (10) +#define SERVER_MAX_PLAYERS (5) #define SERVER_PATHFINDING_INTERVAL (0.25f) typedef enum t_game_state { diff --git a/include/players.h b/include/players.h index 5e512c5..7607788 100644 --- a/include/players.h +++ b/include/players.h @@ -10,7 +10,7 @@ #include "guns.h" #include "sprite.h" -#define MAX_PLAYERS 10 +#define MAX_PLAYERS 5 #define MAX_POINT_ANIMATIONS 10 #define GUN_OFFSET_FROM_PLAYER 0.8f diff --git a/libSDL2.a b/libSDL2.a deleted file mode 100644 index 08f332d..0000000 Binary files a/libSDL2.a and /dev/null differ diff --git a/libSDL2_mixer.a b/libSDL2_mixer.a deleted file mode 100644 index c64f55a..0000000 Binary files a/libSDL2_mixer.a and /dev/null differ diff --git a/src/asset_defs.c b/src/asset_defs.c index 24491fa..43d9c38 100644 --- a/src/asset_defs.c +++ b/src/asset_defs.c @@ -47,8 +47,20 @@ void load_assets() { img_metal_wall2 = assets_load_image_from_file("data/imgs/objects/metal_wall2.png"); // Players + img_gunner_black_run = assets_load_image_from_file("data/imgs/players/Black/Gunner_Black_Run.png"); + img_gunner_black_idle = assets_load_image_from_file("data/imgs/players/Black/Gunner_Black_Idle.png"); + img_gunner_blue_run = assets_load_image_from_file("data/imgs/players/Blue/Gunner_Blue_Run.png"); img_gunner_blue_idle = assets_load_image_from_file("data/imgs/players/Blue/Gunner_Blue_Idle.png"); + + img_gunner_green_run = assets_load_image_from_file("data/imgs/players/Green/Gunner_Green_Run.png"); + img_gunner_green_idle = assets_load_image_from_file("data/imgs/players/Green/Gunner_Green_Idle.png"); + + img_gunner_red_run = assets_load_image_from_file("data/imgs/players/Red/Gunner_Red_Run.png"); + img_gunner_red_idle = assets_load_image_from_file("data/imgs/players/Red/Gunner_Red_Idle.png"); + + img_gunner_yellow_run = assets_load_image_from_file("data/imgs/players/Yellow/Gunner_Yellow_Run.png"); + img_gunner_yellow_idle = assets_load_image_from_file("data/imgs/players/Yellow/Gunner_Yellow_Idle.png"); img_alien_run = assets_load_image_from_file("data/imgs/players/alien_run.png"); // Guns diff --git a/src/players.c b/src/players.c index 0f6087c..b2ebfae 100644 --- a/src/players.c +++ b/src/players.c @@ -458,6 +458,17 @@ color get_color_tint_by_player_index(int index) { return c; } +image* get_player_run_sprite_from_index(int index) { + image* imgs[] = { + img_gunner_blue_run, + img_gunner_black_run, + img_gunner_green_run, + img_gunner_yellow_run, + img_gunner_red_run, + }; + return imgs[index]; +} + void draw_player(platform_window* window, player* p, int index) { float size = get_player_size(window); map_info info = get_map_info(window); @@ -476,7 +487,7 @@ void draw_player(platform_window* window, player* p, int index) { frame = sprite_swap_frame_horizontally(frame); } - renderer->render_image_quad_partial(img_gunner_blue_run, + renderer->render_image_quad_partial(get_player_run_sprite_from_index(index), player_render_x, player_render_y, player_render_x, player_render_y + size, player_render_x + size, player_render_y + size, -- cgit v1.2.3-70-g09d2