From a90ea2ab895442e7d0762ce48c4aceac89f8cd33 Mon Sep 17 00:00:00 2001 From: enano4k <enano4k@gmail.com> Date: Fri, 10 Apr 2020 23:21:35 -0600 Subject: [PATCH] stuff --- include/Character/Player.h | 1 + src/Character/Player.cpp | 136 +++---------------------------------- src/Menus/Intro.cpp | 1 + src/Menus/StageSelect.cpp | 3 +- 4 files changed, 12 insertions(+), 129 deletions(-) diff --git a/include/Character/Player.h b/include/Character/Player.h index 382fd2f..be0b12b 100644 --- a/include/Character/Player.h +++ b/include/Character/Player.h @@ -62,6 +62,7 @@ class Player : public Character //Dash int dash_last_tap_frame; + int dash_velocity; int dash_extra_velocity_x, dash_extra_velocity_y; //Shield diff --git a/src/Character/Player.cpp b/src/Character/Player.cpp index 0d005e1..c44188d 100644 --- a/src/Character/Player.cpp +++ b/src/Character/Player.cpp @@ -136,6 +136,10 @@ void Player::loadPlayerFromXML() if (root_node->hasAttribute("velocity")) this->original_velocity = atoi(root_node->attributes["velocity"].c_str()); + this->dash_velocity = 0; + if (root_node->hasAttribute("dash_velocity")) + this->dash_velocity = atoi(root_node->attributes["dash_velocity"].c_str()); + if (root_node->hasAttribute("primary_weapon_velocity")) this->primary_weapon_velocity = atoi(root_node->attributes["primary_weapon_velocity"].c_str()); else @@ -271,130 +275,6 @@ void Player::inputControl() current_velocity = velocity_override; } - // Double tap - /* - if (up_pressed && !down_pressed && !left_pressed && !right_pressed) //8 - { - if(this->frame - this->pressed_8_last_frameX < 10) - { - this->dash_extra_velocity_y = -20; - this->pressed_8_last_frameX = 0; - }else - { - if(this->dash_extra_velocity_y == 0) - { - this->pressed_8_last_frame = true; - } - } - delta_y = -(current_velocity + velocity_boost) / getSlowdown(); - }else - { - if(this->pressed_8_last_frame) - { - this->pressed_1_last_frameX = 0; - this->pressed_2_last_frameX = 0; - this->pressed_3_last_frameX = 0; - this->pressed_4_last_frameX = 0; - this->pressed_6_last_frameX = 0; - this->pressed_7_last_frameX = 0; - this->pressed_8_last_frameX = this->frame; - this->pressed_9_last_frameX = 0; - } - this->pressed_8_last_frame = false; - } - - if (!up_pressed && down_pressed && !left_pressed && !right_pressed) //2 - { - if(this->frame - this->pressed_2_last_frameX < 10) - { - this->dash_extra_velocity_y = 20; - this->pressed_2_last_frameX = 0; - }else - { - if(this->dash_extra_velocity_y == 0) - { - this->pressed_2_last_frame = true; - } - } - delta_y = (current_velocity + velocity_boost) / getSlowdown(); - }else - { - if(this->pressed_2_last_frame) - { - this->pressed_1_last_frameX = 0; - this->pressed_2_last_frameX = this->frame; - this->pressed_3_last_frameX = 0; - this->pressed_4_last_frameX = 0; - this->pressed_6_last_frameX = 0; - this->pressed_7_last_frameX = 0; - this->pressed_8_last_frameX = 0; - this->pressed_9_last_frameX = 0; - } - this->pressed_2_last_frame = false; - } - - if (!up_pressed && !down_pressed && left_pressed && !right_pressed) //4 - { - if(this->frame - this->pressed_4_last_frameX < 10) - { - this->dash_extra_velocity_x = -20; - this->pressed_4_last_frameX = 0; - }else - { - if(this->dash_extra_velocity_y == 0) - { - this->pressed_4_last_frame = true; - } - } - delta_x = -(current_velocity + velocity_boost) / getSlowdown(); - }else - { - if(this->pressed_4_last_frame) - { - this->pressed_1_last_frameX = 0; - this->pressed_2_last_frameX = 0; - this->pressed_3_last_frameX = 0; - this->pressed_4_last_frameX = this->frame; - this->pressed_6_last_frameX = 0; - this->pressed_7_last_frameX = 0; - this->pressed_8_last_frameX = 0; - this->pressed_9_last_frameX = 0; - } - this->pressed_4_last_frame = false; - } - - - if (!up_pressed && !down_pressed && !left_pressed && right_pressed) //6 - { - if(this->frame - this->pressed_6_last_frameX < 10) - { - this->dash_extra_velocity_x = 20; - this->pressed_6_last_frameX = 0; - }else - { - if(this->dash_extra_velocity_y == 0) - { - this->pressed_6_last_frame = true; - } - } - delta_x = (current_velocity + velocity_boost) / getSlowdown(); - }else - { - if(this->pressed_6_last_frame) - { - this->pressed_1_last_frameX = 0; - this->pressed_2_last_frameX = 0; - this->pressed_3_last_frameX = 0; - this->pressed_4_last_frameX = 0; - this->pressed_6_last_frameX = this->frame; - this->pressed_7_last_frameX = 0; - this->pressed_8_last_frameX = 0; - this->pressed_9_last_frameX = 0; - } - this->pressed_6_last_frame = false; - } - */ - if (up_pressed && !down_pressed && !left_pressed && !right_pressed) //8 { delta_y = -(current_velocity + velocity_boost) / getSlowdown(); @@ -466,28 +346,28 @@ void Player::inputControl() && this->current_state != "dash right" && this->hasState("dash right")) { - dash_extra_velocity_x = 20; + dash_extra_velocity_x = dash_velocity; this->setState("dash right"); } if(dash_pressed && isDownWrapper("4") && this->current_state != "dash left" && this->hasState("dash left")) { - dash_extra_velocity_x = -20; + dash_extra_velocity_x = -dash_velocity; this->setState("dash left"); } if(dash_pressed && isDownWrapper("2") && this->current_state != "dash down" && this->hasState("dash down")) { - dash_extra_velocity_y = 20; + dash_extra_velocity_y = dash_velocity; this->setState("dash down"); } if(dash_pressed && isDownWrapper("8") && this->current_state != "dash up" && this->hasState("dash up")) { - dash_extra_velocity_y = -20; + dash_extra_velocity_y = -dash_velocity; this->setState("dash up"); } diff --git a/src/Menus/Intro.cpp b/src/Menus/Intro.cpp index d1e518e..100bdc2 100644 --- a/src/Menus/Intro.cpp +++ b/src/Menus/Intro.cpp @@ -66,6 +66,7 @@ void intro() frames = 0; + rosalila()->sound->playMusic(std::string(assets_directory) + "intro.ogg", -1); while (true) { // auto skip diff --git a/src/Menus/StageSelect.cpp b/src/Menus/StageSelect.cpp index 2de2ed0..51a9c42 100644 --- a/src/Menus/StageSelect.cpp +++ b/src/Menus/StageSelect.cpp @@ -588,6 +588,7 @@ void stageSelect() player->enemy = enemy; stage->loadFromXML(stage_names[current_stage], false); rosalila()->api_integrator->setCurrentControllerActionSet("InGameControls"); + updateMusic(current_stage); STG *stg = new STG(player, enemy, stage, game_mode, current_player_best_score); if (getIsFirstWin()) @@ -691,7 +692,7 @@ void stageSelect() if (background_color.blue > target_color.blue) background_color.blue--; - updateMusic(current_stage); + //updateMusic(current_stage); rosalila()->graphics->drawImage(background, 0, 0);