mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-21 18:17:03 +08:00
feat(player): add configurable fly Y speed
This commit is contained in:
@@ -34,6 +34,7 @@ private:
|
|||||||
|
|
||||||
float m_max_speed = m_max_walk_speed;
|
float m_max_speed = m_max_walk_speed;
|
||||||
float m_y_speed = 0.0f;
|
float m_y_speed = 0.0f;
|
||||||
|
float m_fly_y_speed = 7.5f;
|
||||||
bool can_up = true;
|
bool can_up = true;
|
||||||
|
|
||||||
float space_on_time = 0.0f;
|
float space_on_time = 0.0f;
|
||||||
@@ -99,6 +100,7 @@ public:
|
|||||||
float& acceleration();
|
float& acceleration();
|
||||||
float& deceleration();
|
float& deceleration();
|
||||||
float& g();
|
float& g();
|
||||||
|
float& fly_y_speed();
|
||||||
|
|
||||||
unsigned place_block() const;
|
unsigned place_block() const;
|
||||||
|
|
||||||
|
|||||||
@@ -565,6 +565,8 @@ void DevPanel::show_player_tab_item() {
|
|||||||
m_player_profile.pos[1],
|
m_player_profile.pos[1],
|
||||||
m_player_profile.pos[2]});
|
m_player_profile.pos[2]});
|
||||||
}
|
}
|
||||||
|
ImGui::SliderFloat("Fly Y Speed", &m_player->fly_y_speed(), 0.0f,
|
||||||
|
100.0f);
|
||||||
ImGui::SliderFloat("Acceleration", &m_player->acceleration(), 1.0f,
|
ImGui::SliderFloat("Acceleration", &m_player->acceleration(), 1.0f,
|
||||||
200.0f);
|
200.0f);
|
||||||
ImGui::SliderFloat("Deceleration", &m_player->deceleration(), 1.0f,
|
ImGui::SliderFloat("Deceleration", &m_player->deceleration(), 1.0f,
|
||||||
|
|||||||
@@ -372,11 +372,11 @@ void Player::update_move(float delta_time) {
|
|||||||
|
|
||||||
if (is_fly) {
|
if (is_fly) {
|
||||||
if (m_move_state.up) {
|
if (m_move_state.up) {
|
||||||
m_y_speed = 7.5f;
|
m_y_speed = m_fly_y_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_move_state.down) {
|
if (m_move_state.down) {
|
||||||
m_y_speed = -7.5f;
|
m_y_speed = -m_fly_y_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_move_state.down && !m_move_state.up) {
|
if (!m_move_state.down && !m_move_state.up) {
|
||||||
@@ -544,6 +544,7 @@ float& Player::max_speed() { return m_max_speed; }
|
|||||||
float& Player::acceleration() { return m_acceleration; }
|
float& Player::acceleration() { return m_acceleration; }
|
||||||
float& Player::deceleration() { return m_deceleration; }
|
float& Player::deceleration() { return m_deceleration; }
|
||||||
float& Player::g() { return m_g; }
|
float& Player::g() { return m_g; }
|
||||||
|
float& Player::fly_y_speed() { return m_fly_y_speed; }
|
||||||
unsigned Player::place_block() const { return m_place_block; };
|
unsigned Player::place_block() const { return m_place_block; };
|
||||||
Gait& Player::gait() { return m_gait; }
|
Gait& Player::gait() { return m_gait; }
|
||||||
GameMode& Player::game_mode() { return m_game_mode; }
|
GameMode& Player::game_mode() { return m_game_mode; }
|
||||||
|
|||||||
Reference in New Issue
Block a user