summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2024-01-02 22:01:43 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2024-01-02 22:01:43 +0100
commitf233cd4f15ea8145bb196a8a88dcb5a18944375b (patch)
tree99ae9602ff6b3b200fb08498d6f39a6146f2d667
parent4283a369307e5d0e40245220e18dac94468f8ff4 (diff)
player colors
-rw-r--r--.gitignore1
-rw-r--r--.vscode/settings.json8
-rw-r--r--build/zombies.exebin2109456 -> 2111357 bytes
-rw-r--r--data/imgs/players/Black/Gunner_Black_Crouch.pngbin0 -> 1408 bytes
-rw-r--r--data/imgs/players/Black/Gunner_Black_Death.pngbin0 -> 3342 bytes
-rw-r--r--data/imgs/players/Black/Gunner_Black_Idle.pngbin0 -> 1543 bytes
-rw-r--r--data/imgs/players/Black/Gunner_Black_Jump.pngbin0 -> 1065 bytes
-rw-r--r--data/imgs/players/Black/Gunner_Black_Run.pngbin0 -> 2450 bytes
-rw-r--r--data/imgs/players/Green/Gunner_Green_Crouch.pngbin0 -> 1479 bytes
-rw-r--r--data/imgs/players/Green/Gunner_Green_Death.pngbin0 -> 3641 bytes
-rw-r--r--data/imgs/players/Green/Gunner_Green_Idle.pngbin0 -> 1665 bytes
-rw-r--r--data/imgs/players/Green/Gunner_Green_Jump.pngbin0 -> 1159 bytes
-rw-r--r--data/imgs/players/Green/Gunner_Green_Run.pngbin0 -> 2518 bytes
-rw-r--r--data/imgs/players/Red/Gunner_Red_Crouch.pngbin0 -> 1425 bytes
-rw-r--r--data/imgs/players/Red/Gunner_Red_Death.pngbin0 -> 3474 bytes
-rw-r--r--data/imgs/players/Red/Gunner_Red_Idle.pngbin0 -> 1502 bytes
-rw-r--r--data/imgs/players/Red/Gunner_Red_Jump.pngbin0 -> 1109 bytes
-rw-r--r--data/imgs/players/Red/Gunner_Red_Run.pngbin0 -> 2357 bytes
-rw-r--r--data/imgs/players/Yellow/Gunner_Yellow_Crouch.pngbin0 -> 1529 bytes
-rw-r--r--data/imgs/players/Yellow/Gunner_Yellow_Death.pngbin0 -> 3582 bytes
-rw-r--r--data/imgs/players/Yellow/Gunner_Yellow_Idle.pngbin0 -> 1513 bytes
-rw-r--r--data/imgs/players/Yellow/Gunner_Yellow_Jump.pngbin0 -> 1169 bytes
-rw-r--r--data/imgs/players/Yellow/Gunner_Yellow_Run.pngbin0 -> 2314 bytes
-rw-r--r--include/asset_defs.h13
-rw-r--r--include/game.h2
-rw-r--r--include/players.h2
-rw-r--r--libSDL2.abin21786444 -> 0 bytes
-rw-r--r--libSDL2_mixer.abin1868194 -> 0 bytes
-rw-r--r--src/asset_defs.c12
-rw-r--r--src/players.c13
30 files changed, 40 insertions, 11 deletions
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
--- a/build/zombies.exe
+++ b/build/zombies.exe
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Black/Gunner_Black_Crouch.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Black/Gunner_Black_Death.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Black/Gunner_Black_Idle.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Black/Gunner_Black_Jump.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Black/Gunner_Black_Run.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Green/Gunner_Green_Crouch.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Green/Gunner_Green_Death.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Green/Gunner_Green_Idle.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Green/Gunner_Green_Jump.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Green/Gunner_Green_Run.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Red/Gunner_Red_Crouch.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Red/Gunner_Red_Death.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Red/Gunner_Red_Idle.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Red/Gunner_Red_Jump.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Red/Gunner_Red_Run.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Yellow/Gunner_Yellow_Crouch.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Yellow/Gunner_Yellow_Death.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Yellow/Gunner_Yellow_Idle.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Yellow/Gunner_Yellow_Jump.png
Binary files 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
--- /dev/null
+++ b/data/imgs/players/Yellow/Gunner_Yellow_Run.png
Binary files 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
--- a/libSDL2.a
+++ /dev/null
Binary files differ
diff --git a/libSDL2_mixer.a b/libSDL2_mixer.a
deleted file mode 100644
index c64f55a..0000000
--- a/libSDL2_mixer.a
+++ /dev/null
Binary files 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,