Skip to content

Commit

Permalink
Combat SFX
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacey2k committed Feb 16, 2024
1 parent 64e6255 commit ecc7180
Show file tree
Hide file tree
Showing 107 changed files with 1,425 additions and 121 deletions.
41 changes: 29 additions & 12 deletions 2D_TF2_Sandbox_2.resource_order

Large diffs are not rendered by default.

30 changes: 27 additions & 3 deletions 2D_TF2_Sandbox_2.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added audio/_null.wav
Binary file not shown.
Binary file added audio/env_distant.wav
Binary file not shown.
Binary file added audio/sfx_shoot_01.wav
Binary file not shown.
Binary file added audio/sfx_shoot_02.wav
Binary file not shown.
Binary file added audio/sfx_shoot_03.wav
Binary file not shown.
File renamed without changes.
17 changes: 13 additions & 4 deletions objects/blu_demo/Other_7.gml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
var cam_size = 600;

var cam_x = camera_get_view_x(view_camera[0]);
var cam_y = camera_get_view_y(view_camera[0]);
var cam_w = camera_get_view_width(view_camera[0]);
var cam_h = camera_get_view_height(view_camera[0]);

var cam_center_x = cam_x + cam_w / 2;
var cam_center_y = cam_y + cam_h / 2;

var obj_x = x;
var obj_y = y;

var in_camera_view = (obj_x >= cam_x && obj_x <= cam_x + cam_size) && (obj_y >= cam_y && obj_y <= cam_y + cam_size);
var in_camera_view = (obj_x >= cam_x && obj_x <= cam_x + cam_w) && (obj_y >= cam_y && obj_y <= cam_y + cam_h);

if (in_camera_view && !audio_is_playing(walk_sound_instance)) {
walk_sound_instance = audio_play_sound(snd_walk, 10, false, 1, 0, random_range(0.65,0.8));
var falloff_ref = 100;
var falloff_max = 500;
var falloff_factor = 1;
var adjusted_obj_x = cam_center_x - obj_x;

walk_sound_instance = audio_play_sound_at(snd_walk, adjusted_obj_x, obj_y - cam_center_y, 0, falloff_ref, falloff_max, falloff_factor, 0, 10, 1, 0, random_range(0.65,0.8));
} else if (!in_camera_view || audio_is_playing(walk_sound_instance)) {
audio_stop_sound(walk_sound_instance);
}
}
3 changes: 2 additions & 1 deletion objects/blu_engie/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ move_cooldown = move_cooldown_timer;
walk_sound_instance = audio_play_sound(snd_walk, 10, false);
audio_stop_sound(walk_sound_instance); // Stop it immediately so it can be started in the animation end script


shoot_sound = audio_play_sound(snd_shoot_03, 10, false);
audio_stop_sound(shoot_sound);



Expand Down
17 changes: 13 additions & 4 deletions objects/blu_engie/Other_7.gml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
var cam_size = 600;

var cam_x = camera_get_view_x(view_camera[0]);
var cam_y = camera_get_view_y(view_camera[0]);
var cam_w = camera_get_view_width(view_camera[0]);
var cam_h = camera_get_view_height(view_camera[0]);

var cam_center_x = cam_x + cam_w / 2;
var cam_center_y = cam_y + cam_h / 2;

var obj_x = x;
var obj_y = y;

var in_camera_view = (obj_x >= cam_x && obj_x <= cam_x + cam_size) && (obj_y >= cam_y && obj_y <= cam_y + cam_size);
var in_camera_view = (obj_x >= cam_x && obj_x <= cam_x + cam_w) && (obj_y >= cam_y && obj_y <= cam_y + cam_h);

if (in_camera_view && !audio_is_playing(walk_sound_instance)) {
walk_sound_instance = audio_play_sound(snd_walk, 10, false, 1, 0, random_range(0.95,1.15));
var falloff_ref = 100;
var falloff_max = 500;
var falloff_factor = 1;
var adjusted_obj_x = cam_center_x - obj_x;

walk_sound_instance = audio_play_sound_at(snd_walk, adjusted_obj_x, obj_y - cam_center_y, 0, falloff_ref, falloff_max, falloff_factor, 0, 10, 1, 0, random_range(0.95,1.15));
} else if (!in_camera_view || audio_is_playing(walk_sound_instance)) {
audio_stop_sound(walk_sound_instance);
}
}
1 change: 1 addition & 0 deletions objects/blu_engie/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ switch (state) {
bullet.owner = npc_username;

instance_create_layer(x, y, "Effects", wep_flash);
sound_engie_fire();

var aim_direction = point_direction(x, y, target.x, target.y);
var aim_error = irandom_range(-4, 4);
Expand Down
3 changes: 3 additions & 0 deletions objects/blu_heavy/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ move_cooldown = move_cooldown_timer;

walk_sound_instance = audio_play_sound(snd_walk, 10, false);
audio_stop_sound(walk_sound_instance); // Stop it immediately so it can be started in the animation end script

shoot_sound = audio_play_sound(snd_shoot_gatling, 10, false);
audio_stop_sound(shoot_sound);
17 changes: 13 additions & 4 deletions objects/blu_heavy/Other_7.gml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
var cam_size = 600;

var cam_x = camera_get_view_x(view_camera[0]);
var cam_y = camera_get_view_y(view_camera[0]);
var cam_w = camera_get_view_width(view_camera[0]);
var cam_h = camera_get_view_height(view_camera[0]);

var cam_center_x = cam_x + cam_w / 2;
var cam_center_y = cam_y + cam_h / 2;

var obj_x = x;
var obj_y = y;

var in_camera_view = (obj_x >= cam_x && obj_x <= cam_x + cam_size) && (obj_y >= cam_y && obj_y <= cam_y + cam_size);
var in_camera_view = (obj_x >= cam_x && obj_x <= cam_x + cam_w) && (obj_y >= cam_y && obj_y <= cam_y + cam_h);

if (in_camera_view && !audio_is_playing(walk_sound_instance)) {
walk_sound_instance = audio_play_sound(snd_walk, 10, false, 1, 0, random_range(0.55,0.65));
var falloff_ref = 100;
var falloff_max = 500;
var falloff_factor = 1;
var adjusted_obj_x = cam_center_x - obj_x;

walk_sound_instance = audio_play_sound_at(snd_walk, adjusted_obj_x, obj_y - cam_center_y, 0, falloff_ref, falloff_max, falloff_factor, 0, 10, 1, 0, random_range(0.55,0.65));
} else if (!in_camera_view || audio_is_playing(walk_sound_instance)) {
audio_stop_sound(walk_sound_instance);
}
}
1 change: 1 addition & 0 deletions objects/blu_heavy/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if (target != noone && point_distance(x, y, target.x, target.y) <= shooting_rang
bullet.owner = npc_username;

instance_create_layer(x, y, "Effects", wep_flash);
sound_heavy_fire();

var aim_direction = point_direction(x, y, target.x, target.y);
var aim_error = irandom_range(-10, 10);
Expand Down
Loading

0 comments on commit ecc7180

Please sign in to comment.