diff options
author | Max-001 <maxsmits21@kpnmail.nl> | 2024-12-29 12:29:40 +0100 |
---|---|---|
committer | Max-001 <maxsmits21@kpnmail.nl> | 2024-12-29 12:29:40 +0100 |
commit | e7cebc43f567b0fa1701d953a9f25d5f527e89bb (patch) | |
tree | b53e2f18c506f0f2771e236fa6830d2e0af59622 /game/player | |
parent | bc66ba7754dec9d6f907bc69730f211ae2215906 (diff) |
Added Player params to Config
Diffstat (limited to 'game/player')
-rw-r--r-- | game/player/PlayerEndScript.cpp | 4 | ||||
-rw-r--r-- | game/player/PlayerScript.cpp | 5 | ||||
-rw-r--r-- | game/player/PlayerSubScene.cpp | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/game/player/PlayerEndScript.cpp b/game/player/PlayerEndScript.cpp index 80d3011..8833c28 100644 --- a/game/player/PlayerEndScript.cpp +++ b/game/player/PlayerEndScript.cpp @@ -1,5 +1,7 @@ #include "PlayerEndScript.h" +#include "../Config.h" + #include <crepe/api/Animator.h> #include <crepe/api/BoxCollider.h> #include <crepe/api/CircleCollider.h> @@ -50,7 +52,7 @@ bool PlayerEndScript::on_collision(const crepe::CollisionEvent & ev) { } else if (jump == 2) { rb_player.data.angular_velocity = 0; rb_player.data.elasticity_coefficient = 0; - rb_player.data.linear_velocity = vec2(100, 0); + rb_player.data.linear_velocity = vec2(PLAYER_SPEED, 0); rb_player.data.linear_velocity_coefficient = vec2(0.5, 0.5); rb_camera.data.linear_velocity_coefficient = vec2(0.5, 0.5); for (Animator & anim : anim_player) { diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp index 7f5d0c4..3b4cc5e 100644 --- a/game/player/PlayerScript.cpp +++ b/game/player/PlayerScript.cpp @@ -1,5 +1,6 @@ #include "PlayerScript.h" -#include "api/BehaviorScript.h" + +#include "../Config.h" #include <crepe/api/Animator.h> #include <crepe/api/ParticleEmitter.h> @@ -79,7 +80,7 @@ void PlayerScript::fixed_update(crepe::duration_t dt) { Rigidbody & rb = this->get_components_by_name<Rigidbody>("player").front(); if (this->get_key_state(Keycode::SPACE)) { - rb.add_force_linear(vec2(0, -10)); + rb.add_force_linear(vec2(0, -PLAYER_GRAVITY_SCALE / 3)); if (prev_anim != 1) { for (Animator & anim : animators) { anim.active = true; diff --git a/game/player/PlayerSubScene.cpp b/game/player/PlayerSubScene.cpp index 91ae882..7e78e82 100644 --- a/game/player/PlayerSubScene.cpp +++ b/game/player/PlayerSubScene.cpp @@ -141,9 +141,9 @@ PlayerSubScene::PlayerSubScene(Scene & scn) { ); player.add_component<BoxCollider>(vec2(40, 60), vec2(-20, 0)); player.add_component<Rigidbody>(Rigidbody::Data { - .gravity_scale = 20, + .gravity_scale = PLAYER_GRAVITY_SCALE, .body_type = Rigidbody::BodyType::DYNAMIC, - .linear_velocity = vec2(100, 0), + .linear_velocity = vec2(PLAYER_SPEED, 0), .collision_layers = {COLL_LAY_BOT_TOP, COLL_LAY_ZAPPER, COLL_LAY_LASER, COLL_LAY_MISSILE}, .collision_layer = COLL_LAY_PLAYER, |