From: Matthias Braun Date: Mon, 22 Nov 2004 17:51:50 +0000 (+0000) Subject: enemies fall down again, small improvements to tile manager X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=7981f4c11e7e98eadfc331cc3b59e28e7a9e6e8f;p=supertux.git enemies fall down again, small improvements to tile manager SVN-Revision: 2135 --- diff --git a/TODO b/TODO index 894bfcc9f..e1b401eca 100644 --- a/TODO +++ b/TODO @@ -63,7 +63,7 @@ L: low priority - implement tree (really?) - bring back stay on platform flag - make enemies bounce of upon each other again - - make enemies fall again + - make enemies fall again - ok -* activate/deactive enemies when on screen/away again - ok ** implement ability to cary mriceblock (and other objects) around - delayed for after big commit... @@ -85,6 +85,11 @@ L: low priority * fix flapping ** having a star doesn't kill enemies - ok * tux always jumps to full height at the moment + * invisble blocks are visible and make the game crash when bumped + * reimplement spikes as objects + * what to do when stuck under tiles (after using duck-sliding) + * do we want multi hit scores again? + * tux doesn't stop at igloo anymore --Code Refactoring/Cleanup/Optimisation-- [H] make the title using GameSession instead of reimplementing all the stuff diff --git a/contrib/tilemanager/Application.cs b/contrib/tilemanager/Application.cs index 66550e54c..fb2059313 100644 --- a/contrib/tilemanager/Application.cs +++ b/contrib/tilemanager/Application.cs @@ -61,6 +61,10 @@ public class Application { Application app = new Application(); + /* that's no proper commandlineparsing, but who'll notice... */ + if(args.Length == 1) + app.LoadTileSet(args[0]); + kit.Run(); return 0; } @@ -101,6 +105,10 @@ public class Application { string file = selection.Filename; selection.Destroy(); + LoadTileSet(file); + } + + private void LoadTileSet(string file) { try { tileset = new TileSet(); tileset.Parse(file); @@ -277,6 +285,9 @@ public class Application { } private void OnDrawingAreaButtonPress(object o, ButtonPressEventArgs e) { + if(SelectionArray == null) + return; + selecting = true; for(int i = 0; i < SelectionArray.Length; ++i) diff --git a/contrib/tilemanager/TODO b/contrib/tilemanager/TODO index 9c2987aea..258dc1ffe 100644 --- a/contrib/tilemanager/TODO +++ b/contrib/tilemanager/TODO @@ -2,3 +2,5 @@ -show tile images next to tile numbers -allow removing of tiles -undo ? +-combobox only works after enter has been pressed + diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 375441415..6068bde81 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -24,8 +24,11 @@ BadGuy::draw(DrawingContext& context) return; if(state == STATE_INIT || state == STATE_INACTIVE) return; - - sprite->draw(context, get_pos(), LAYER_OBJECTS); + if(state == STATE_FALLING) { + sprite->draw(context, get_pos(), LAYER_OBJECTS, VERTICAL_FLIP); + } else { + sprite->draw(context, get_pos(), LAYER_OBJECTS); + } } void @@ -164,7 +167,6 @@ BadGuy::kill_fall() physic.set_velocity_y(0); physic.enable_gravity(true); set_state(STATE_FALLING); - remove_me(); } void diff --git a/src/player.cpp b/src/player.cpp index 9200ae6ce..fa9d84a66 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -16,7 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - #include #include @@ -266,31 +265,12 @@ Player::action(float elapsed_time) if (input.fire == UP) holding_something = false; - /* --- HANDLE TUX! --- */ if(dying == DYING_NOT) handle_input(); movement = physic.get_movement(elapsed_time); - if(dying == DYING_NOT) - { #if 0 - collision_swept_object_map(&old_base, &base); - - if ((!invincible_timer.started() && !safe_timer.started()) - && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y) - || isspike(base.x, base.y + base.height) - || isspike(base.x + base.width, base.y + base.height))) - { - kill(SHRINK); - } - - // Don't accelerate Tux if he is running against a wall - if (target.x != base.x) - { - physic.set_velocity_x(0); - } - // special exception for cases where we're stuck under tiles after // being ducked. In this case we drift out if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y @@ -300,31 +280,8 @@ Player::action(float elapsed_time) previous_base = old_base = base; } - // Land: - if (!on_ground()) - { - physic.enable_gravity(true); - if(under_solid()) - { - // fall down - physic.set_velocity_y(0); - jumped_in_solid = true; - jumping = false; - flapping = false; - } - } - else - { - /* Land: */ - if (physic.get_velocity_y() < 0) - { - base.y = (int)(((int)base.y / 32) * 32); - physic.set_velocity_y(0); - } - - physic.enable_gravity(false); - /* Reset score multiplier (for multi-hits): */ - if (!invincible_timer.started()) + /* Reset score multiplier (for multi-hits): */ + if (!invincible_timer.started()) { if(player_status.score_multiplier > player_status.max_score_multiplier) { @@ -339,55 +296,8 @@ Player::action(float elapsed_time) } } - if(jumped_in_solid) - { - if (isbrick(base.x, base.y) || - isfullbox(base.x, base.y)) - { - Sector::current()->trygrabdistro( - Vector(base.x, base.y - 32), BOUNCE); - Sector::current()->trybumpbadguy(Vector(base.x, base.y - 64)); - - Sector::current()->trybreakbrick( - Vector(base.x, base.y), size == SMALL); - - bumpbrick(base.x, base.y); - Sector::current()->tryemptybox(Vector(base.x, base.y), RIGHT); - } - - if (isbrick(base.x+ 31, base.y) || - isfullbox(base.x+ 31, base.y)) - { - Sector::current()->trygrabdistro( - Vector(base.x+ 31, base.y - 32), BOUNCE); - Sector::current()->trybumpbadguy(Vector(base.x+ 31, base.y - 64)); - - if(size == BIG) - Sector::current()->trybreakbrick( - Vector(base.x+ 31, base.y), size == SMALL); - - bumpbrick(base.x+ 31, base.y); - Sector::current()->tryemptybox(Vector(base.x+ 31, base.y), LEFT); - } - } -#endif - - grabdistros(); - -#if 0 - if (jumped_in_solid) - { - ++base.y; - ++old_base.y; - if(on_ground()) - { - /* Make sure jumping is off. */ - jumping = false; - flapping = false; - } - } -#endif } +#endif on_ground_flag = false; } @@ -546,6 +456,7 @@ Player::handle_vertical_input() } if (jumping && physic.get_velocity_y() > 0) { + printf("jumpend.\n"); jumping = false; physic.set_velocity_y(0); } @@ -746,24 +657,23 @@ void Player::handle_input() { /* Handle horizontal movement: */ - handle_horizontal_input(); + handle_horizontal_input(); /* Jump/jumping? */ - if (on_ground() && input.jump == UP) can_jump = true; handle_vertical_input(); /* Shoot! */ - if (input.fire == DOWN && input.old_fire == UP && got_power != NONE_POWER) - { - if(Sector::current()->add_bullet( - get_pos() + Vector(0, bbox.get_height()/2), + if (input.fire == DOWN && input.old_fire == UP && got_power != NONE_POWER) { + if(Sector::current()->add_bullet( + get_pos() + Vector(0, bbox.get_height()/2), physic.get_velocity_x(), dir)) - shooting_timer.start(SHOOTING_TIME); - input.old_fire = DOWN; - } + shooting_timer.start(SHOOTING_TIME); + input.old_fire = DOWN; + } +#if 0 /* tux animations: */ if(frame_timer.check()) { if (input.right == UP && input.left == UP) @@ -783,6 +693,7 @@ Player::handle_input() frame_ = 1; } } +#endif /* Duck! */ if (input.down == DOWN && size == BIG && !duck diff --git a/src/tile.cpp b/src/tile.cpp index 29575a04e..af6757891 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -17,7 +17,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. - #include #include