From b31934cc6867be10e986a4bd4d0ab81dc91d56ec Mon Sep 17 00:00:00 2001 From: Max-001 Date: Mon, 6 Jan 2025 10:14:58 +0100 Subject: Paralax stops when player stops --- game/GameScene.cpp | 2 +- game/player/PlayerEndScript.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'game') diff --git a/game/GameScene.cpp b/game/GameScene.cpp index 821191d..a8fcb47 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -100,7 +100,7 @@ void GameScene::load_scene() { .collision_layer = COLL_LAY_LASER, }); laser.add_component(vec2(100, 100)); - GameObject missile = new_object("missile", "missile", vec2(3000, 0)); + GameObject missile = new_object("missile", "missile", vec2(4000, 0)); Asset missile_asset {"asset/obstacles/missile/missile.png"}; Sprite & missile_sprite = missile.add_component( missile_asset, diff --git a/game/player/PlayerEndScript.cpp b/game/player/PlayerEndScript.cpp index 8833c28..4cd2cd0 100644 --- a/game/player/PlayerEndScript.cpp +++ b/game/player/PlayerEndScript.cpp @@ -50,6 +50,12 @@ bool PlayerEndScript::on_collision(const crepe::CollisionEvent & ev) { } else if (jump == 1) { jump++; } else if (jump == 2) { + RefVector rb_back_forest + = this->get_components_by_tag("forest_background"); + for (Rigidbody & rb : rb_back_forest) { + rb.data.linear_velocity_coefficient = vec2(0.5, 0.5); + } + rb_player.data.angular_velocity = 0; rb_player.data.elasticity_coefficient = 0; rb_player.data.linear_velocity = vec2(PLAYER_SPEED, 0); -- cgit v1.2.3