diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-08 10:47:47 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-08 10:47:47 +0100 |
commit | 65cdd7966c276dd7b1ffec7bf0de243b9370eeb1 (patch) | |
tree | 938c6ed098f2141a6a5c2d56146325938ae868bd /game/player/PlayerSubScene.cpp | |
parent | 6112da75f973b1099fa95fcd9d3113c00302f5b4 (diff) | |
parent | ad5fb53986fcc3f3b3c5369574e0f8e95051f3d9 (diff) |
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/enemyAI
Diffstat (limited to 'game/player/PlayerSubScene.cpp')
-rw-r--r-- | game/player/PlayerSubScene.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/game/player/PlayerSubScene.cpp b/game/player/PlayerSubScene.cpp index 99a0fb4..be104b5 100644 --- a/game/player/PlayerSubScene.cpp +++ b/game/player/PlayerSubScene.cpp @@ -1,10 +1,14 @@ #include "PlayerSubScene.h" +#include "PlayerAudioScript.h" #include "PlayerEndScript.h" #include "PlayerScript.h" #include "../Config.h" +#include "../coins/CoinScript.h" +#include "api/Asset.h" #include <crepe/api/Animator.h> +#include <crepe/api/AudioSource.h> #include <crepe/api/BoxCollider.h> #include <crepe/api/CircleCollider.h> #include <crepe/api/GameObject.h> @@ -148,6 +152,52 @@ PlayerSubScene::PlayerSubScene(Scene & scn) { = {COLL_LAY_BOT_TOP, COLL_LAY_ZAPPER, COLL_LAY_LASER, COLL_LAY_MISSILE,COLL_LAY_BULLET}, .collision_layer = COLL_LAY_PLAYER, }); - player.add_component<BehaviorScript>().set_script<PlayerScript>().active = true; + player.add_component<BehaviorScript>().set_script<PlayerScript>().active = false; + player.add_component<BehaviorScript>().set_script<CoinScript>(); player.add_component<BehaviorScript>().set_script<PlayerEndScript>().active = false; + + player.add_component<AudioSource>(Asset("asset/sfx/dud_zapper_lp.ogg")); + player.add_component<AudioSource>(Asset("asset/sfx/dud_zapper_pop.ogg")); + player.add_component<AudioSource>(Asset("asset/sfx/dud_fire.ogg")); + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_01.ogg")).volume + = 0.1; + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_02.ogg")).volume + = 0.1; + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_03.ogg")).volume + = 0.1; + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_04.ogg")).volume + = 0.1; + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_05.ogg")).volume + = 0.1; + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_06.ogg")).volume + = 0.1; + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_07.ogg")).volume + = 0.1; + player.add_component<AudioSource>(Asset("asset/sfx/jetpack_firecracker_lp_08.ogg")).volume + = 0.1; + + GameObject player_audio = scn.new_object("player_audio", "player_audio", vec2(0, 0)); + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_left_1.ogg")).volume + = 3.0; + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_right_1.ogg")) + .volume + = 3.0; + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_left_2.ogg")).volume + = 3.0; + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_right_2.ogg")) + .volume + = 3.0; + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_left_3.ogg")).volume + = 3.0; + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_right_3.ogg")) + .volume + = 3.0; + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_left_4.ogg")).volume + = 3.0; + player_audio.add_component<AudioSource>(Asset("asset/sfx/barefoot_step_right_4.ogg")) + .volume + = 3.0; + + player_audio.add_component<BehaviorScript>().set_script<PlayerAudioScript>().active + = false; } |