diff options
author | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-10 17:07:28 +0100 |
---|---|---|
committer | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-10 17:07:28 +0100 |
commit | 912774706bab1e7817facb3cff12e961a89d1980 (patch) | |
tree | 0896b12c29dccc247c69e54daaa32d8ce3097ed0 /game/player | |
parent | 90a33d36c34b1512270a6724564995dd8bf914a6 (diff) | |
parent | 7aa07561a52016007ff852acefa4db68260f0f1e (diff) |
Merge remote-tracking branch 'origin/wouter/game-improvements' into max/game2
Diffstat (limited to 'game/player')
-rw-r--r-- | game/player/PlayerBulletSubScene.cpp | 2 | ||||
-rw-r--r-- | game/player/PlayerScript.cpp | 2 | ||||
-rw-r--r-- | game/player/PlayerScript.h | 3 | ||||
-rw-r--r-- | game/player/PlayerSubScene.cpp | 5 |
4 files changed, 7 insertions, 5 deletions
diff --git a/game/player/PlayerBulletSubScene.cpp b/game/player/PlayerBulletSubScene.cpp index 5e1c66e..82ce4a9 100644 --- a/game/player/PlayerBulletSubScene.cpp +++ b/game/player/PlayerBulletSubScene.cpp @@ -24,7 +24,7 @@ int PlayerBulletSubScene::create(Scene & scn, int counter) { Rigidbody & player_bullet_body = player_bullet.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 0, .body_type = Rigidbody::BodyType::KINEMATIC, - .linear_velocity = vec2 {400, 0}, + .linear_velocity = vec2 {450, 0}, .angular_velocity = 300, .kinematic_collision = false, .collision_layers = {COLL_LAY_ENEMY, COLL_LAY_ZAPPER}, diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp index 286cdaf..8cbe8dc 100644 --- a/game/player/PlayerScript.cpp +++ b/game/player/PlayerScript.cpp @@ -163,7 +163,7 @@ void PlayerScript::fixed_update(crepe::duration_t dt) { if (current_jetpack_sound > 7) { current_jetpack_sound = 0; } - } else if (transform.position.y == 195) { + } else if (transform.position.y == 200) { Rigidbody & rb = this->body; if (prev_anim != 0 && rb.data.linear_velocity.x != 0) { for (Animator & anim : animators) { diff --git a/game/player/PlayerScript.h b/game/player/PlayerScript.h index 6875b05..6a7dedb 100644 --- a/game/player/PlayerScript.h +++ b/game/player/PlayerScript.h @@ -22,8 +22,9 @@ private: private: int prev_anim = 0; std::chrono::time_point<std::chrono::steady_clock> last_fired; + std::chrono::time_point<std::chrono::steady_clock> last_switched; std::chrono::duration<float> shot_delay = std::chrono::duration<float>(0.5); - + std::chrono::duration<float> switch_delay = std::chrono::duration<float>(0.01); int current_jetpack_sound = 0; float & engine_gravity = crepe::Config::get_instance().physics.gravity; diff --git a/game/player/PlayerSubScene.cpp b/game/player/PlayerSubScene.cpp index 3aeabfe..d0142e0 100644 --- a/game/player/PlayerSubScene.cpp +++ b/game/player/PlayerSubScene.cpp @@ -123,7 +123,7 @@ PlayerSubScene::PlayerSubScene(Scene & scn) { .looping = true, } ); - player.add_component<BoxCollider>(vec2(50, 50)); + player.add_component<BoxCollider>(vec2(50, 35)); Asset player_head_asset {"asset/barry/defaultHead.png"}; Sprite & player_head_sprite = player.add_component<Sprite>( player_head_asset, @@ -160,7 +160,7 @@ PlayerSubScene::PlayerSubScene(Scene & scn) { .looping = true, } ); - player.add_component<BoxCollider>(vec2(40, 60), vec2(-20, 0)); + player.add_component<BoxCollider>(vec2(40, 50), vec2(-20, 0)); player.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 1.0, .body_type = Rigidbody::BodyType::DYNAMIC, @@ -170,6 +170,7 @@ PlayerSubScene::PlayerSubScene(Scene & scn) { }, .collision_layer = COLL_LAY_PLAYER, }); + 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; |