diff options
Diffstat (limited to 'game')
-rw-r--r-- | game/player/PlayerEndScript.cpp | 3 | ||||
-rw-r--r-- | game/player/PlayerSubScene.cpp | 25 | ||||
-rw-r--r-- | game/scheduler/ObjectsScheduler.cpp | 12 |
3 files changed, 33 insertions, 7 deletions
diff --git a/game/player/PlayerEndScript.cpp b/game/player/PlayerEndScript.cpp index 4ae813f..62fd350 100644 --- a/game/player/PlayerEndScript.cpp +++ b/game/player/PlayerEndScript.cpp @@ -92,8 +92,9 @@ bool PlayerEndScript::on_collision(const crepe::CollisionEvent & ev) { jump++; } - if (rb_player.data.linear_velocity.x < 5 && jump >= 3) { + if (rb_player.data.linear_velocity.x < 5 && jump == 3) { this->trigger_event<EndGameEvent>(); + jump++; } return false; diff --git a/game/player/PlayerSubScene.cpp b/game/player/PlayerSubScene.cpp index 4d17c47..d0142e0 100644 --- a/game/player/PlayerSubScene.cpp +++ b/game/player/PlayerSubScene.cpp @@ -5,8 +5,8 @@ #include "../Config.h" #include "../coins/CoinScript.h" -#include "api/Asset.h" +#include <crepe/ValueBroker.h> #include <crepe/api/Animator.h> #include <crepe/api/AudioSource.h> #include <crepe/api/BoxCollider.h> @@ -16,6 +16,7 @@ #include <crepe/api/Scene.h> #include <crepe/api/Script.h> #include <crepe/api/Sprite.h> +#include <crepe/manager/SaveManager.h> #include <crepe/types.h> using namespace crepe; @@ -24,7 +25,23 @@ using namespace std; PlayerSubScene::PlayerSubScene(Scene & scn) { GameObject player = scn.new_object("player", "player", vec2(-100, 200)); - Asset player_bullet {"asset/other_effects/effect_smgbullet.png"}; + SaveManager & save = scn.get_save_manager(); + ValueBroker<int> particle_type = save.get<int>(JETPACK_PARTICLES, 0); + + string player_bullet_string; + string player_bullet_x2_string; + string player_shell_string; + if (particle_type.get() == 0) { + player_bullet_string = "asset/other_effects/effect_smgbullet.png"; + player_bullet_x2_string = "asset/other_effects/effect_smgbullet_x2.png"; + player_shell_string = "asset/other_effects/effect_rocketmgshell_TVOS.png"; + } else { + player_bullet_string = "asset/background/aquarium/bubble.png"; + player_bullet_x2_string = "asset/background/aquarium/bubble.png"; + player_shell_string = "asset/background/aquarium/bubble.png"; + } + + Asset player_bullet {player_bullet_string}; Sprite & player_bullet_sprite = player.add_component<Sprite>( player_bullet, Sprite::Data { @@ -45,7 +62,7 @@ PlayerSubScene::PlayerSubScene(Scene & scn) { .reset_on_exit = true, }, }); - Asset player_bullet_x2 {"asset/other_effects/effect_smgbullet_x2.png"}; + Asset player_bullet_x2 {player_bullet_x2_string}; Sprite & player_bullet_x2_sprite = player.add_component<Sprite>( player_bullet_x2, Sprite::Data { @@ -66,7 +83,7 @@ PlayerSubScene::PlayerSubScene(Scene & scn) { .reset_on_exit = true, }, }); - Asset player_shell {"asset/other_effects/effect_rocketmgshell_TVOS.png"}; + Asset player_shell {player_shell_string}; Sprite & player_shell_sprite = player.add_component<Sprite>( player_shell, Sprite::Data { diff --git a/game/scheduler/ObjectsScheduler.cpp b/game/scheduler/ObjectsScheduler.cpp index c33c707..0839fe5 100644 --- a/game/scheduler/ObjectsScheduler.cpp +++ b/game/scheduler/ObjectsScheduler.cpp @@ -57,10 +57,18 @@ bool ObjectsScheduler::boss_fight_1_event() { this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02; + bool first = true; RefVector<Rigidbody> rb_back_forest = this->get_components_by_tag<Rigidbody>("forest_background"); - rb_back_forest.front().get().data.linear_velocity.x = 30; - rb_back_forest.back().get().data.linear_velocity.x = 40; + for (Rigidbody & rb : rb_back_forest) { + if (first == true) { + rb.data.linear_velocity.x = 30; + first = false; + } else { + rb.data.linear_velocity.x = 40; + first = true; + } + } return false; } |