From: Ricardo Cruz Date: Sat, 30 Oct 2004 11:45:44 +0000 (+0000) Subject: Added my own flapping. :) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=935c2f6a2a27248de63fba86b74a724675761487;p=supertux.git Added my own flapping. :) Made flapping to be configurable, just to get some feedback from players. To try the different ones, type: 'marek', 'ricardo' and 'ryan' during game. Marek is default. SVN-Revision: 2077 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 7f26d6932..15ebac5ad 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -477,6 +477,22 @@ GameSession::process_events() currentsector->camera->reset(Vector(tux.base.x, tux.base.y)); last_keys.clear(); } + // temporary to help player's choosing a flapping + if(compare_last(last_keys, "marek")) + { + tux.flapping_mode = Player::MAREK_FLAP; + last_keys.clear(); + } + if(compare_last(last_keys, "ricardo")) + { + tux.flapping_mode = Player::RICARDO_FLAP; + last_keys.clear(); + } + if(compare_last(last_keys, "ryan")) + { + tux.flapping_mode = Player::RYAN_FLAP; + last_keys.clear(); + } break; case SDL_JOYAXISMOTION: diff --git a/src/player.cpp b/src/player.cpp index e318ee91c..7dd411198 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -169,7 +169,13 @@ Player::init() butt_jump = false; flapping_velocity = 0; - + + // temporary to help player's choosing a flapping + int flapping_mode = MAREK_FLAP; + + // Ricardo's flapping + flaps_nb = 0; + frame_main = 0; frame_ = 0; @@ -571,6 +577,7 @@ Player::handle_vertical_input() flapping = false; can_jump = false; can_flap = false; + flaps_nb = 0; // Ricardo's flapping if (size == SMALL) SoundManager::get()->play_sound(IDToSound(SND_JUMP)); else @@ -590,7 +597,21 @@ Player::handle_vertical_input() } } - + // temporary to help player's choosing a flapping + if(flapping_mode == RICARDO_FLAP) + { + // Flapping, Ricardo's version + // similar to SM3 Fox + if(input.jump == DOWN && input.old_jump == UP && can_flap && + flaps_nb < 3) + { + physic.set_velocity_y(3.5); + physic.set_velocity_x(physic.get_velocity_x() * 0.35); + flaps_nb++; + } + } + else if(flapping_mode == MAREK_FLAP) + { // Flapping, Marek's version if (input.jump == DOWN && can_flap) { @@ -617,8 +638,10 @@ Player::handle_vertical_input() physic.set_velocity_y((float)flapping_timer.get_gone()/850); } } - - /* // Flapping, Ryan's version + } + else if(flapping_mode == RYAN_FLAP) + { + // Flapping, Ryan's version if (input.jump == DOWN && can_flap) { if (!flapping_timer.started()) @@ -658,7 +681,8 @@ Player::handle_vertical_input() { physic.set_acceleration_y(0); } - */ + } + // Hover //(disabled by default, use cheat code "hover" to toggle on/off) diff --git a/src/player.h b/src/player.h index 002a6cd8a..e76b93b0e 100644 --- a/src/player.h +++ b/src/player.h @@ -160,6 +160,13 @@ public: float flapping_velocity; + // Ricardo's flapping + int flaps_nb; + + // temporary to help player's choosing a flapping + enum { MAREK_FLAP, RICARDO_FLAP, RYAN_FLAP, NONE_FLAP }; + int flapping_mode; + base_type previous_base; Timer invincible_timer; Timer skidding_timer;