From: Matthias Braun Date: Sun, 3 Apr 2005 21:22:05 +0000 (+0000) Subject: had more changes lying around here X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=abf179b33deb4040bb583e29207eaf1dd2ee0780;p=supertux.git had more changes lying around here SVN-Revision: 2323 --- diff --git a/data/levels/test/autoscroll.stl b/data/levels/test/autoscroll.stl index 7e4b28745..34f50843c 100644 --- a/data/levels/test/autoscroll.stl +++ b/data/levels/test/autoscroll.stl @@ -7,7 +7,7 @@ (sector (name "main") (gravity 10) - (music "supertux-2.ogg") + (music "credits.ogg") (background (image "arctis.jpg") (speed 0.5) diff --git a/src/badguy/badguy.h b/src/badguy/badguy.h index 92bd0104e..bb31e718d 100644 --- a/src/badguy/badguy.h +++ b/src/badguy/badguy.h @@ -27,13 +27,24 @@ public: BadGuy(); ~BadGuy(); - //virtual void action_activated(float elapsed_time); - + /** Called when the badguy is drawn. The default implementation simply draws + * the badguy sprite on screen + */ virtual void draw(DrawingContext& context); + /** Called each frame. The default implementation checks badguy state and + * calls active_action and inactive_action + */ virtual void action(float elapsed_time); + /** Called when a collision with another object occured. The default + * implemetnation calls collision_player, collision_solid, collision_badguy + * and collision_squished + */ virtual HitResponse collision(GameObject& other, const CollisionHit& hit); + /** Set the badguy to kill/falling state, which makes him falling of the + * screen (his sprite is turned upside-down) + */ virtual void kill_fall(); Vector get_start_position() const @@ -53,17 +64,25 @@ protected: STATE_SQUISHED, STATE_FALLING }; - + + /** Called when the badguy collided with a player */ virtual HitResponse collision_player(Player& player, const CollisionHit& hit); + /** Called when the badguy collided with solid ground */ virtual HitResponse collision_solid(GameObject& other, const CollisionHit& hit); + /** Called when the badguy collided with another badguy */ virtual HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit); - + + /** Called when the player hit the badguy from above. You should return true + * if the badguy was squished, false if squishing wasn't possible + */ virtual bool collision_squished(Player& player); + /** called each frame when the badguy is activated. */ virtual void active_action(float elapsed_time); + /** called each frame when the badguy is not activated. */ virtual void inactive_action(float elapsed_time); /** diff --git a/src/badguy/stalactite.h b/src/badguy/stalactite.h index 62ab23034..6fc8078db 100644 --- a/src/badguy/stalactite.h +++ b/src/badguy/stalactite.h @@ -18,7 +18,6 @@ public: void deactivate(); private: - Physic physic; Timer2 timer; enum StalactiteState { diff --git a/src/object/player.cpp b/src/object/player.cpp index e4d8c6efb..0fcc752cf 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -550,18 +550,17 @@ Player::handle_vertical_input() } } -#if 0 /* In case the player has pressed Down while in a certain range of air, enable butt jump action */ if (input.down && !butt_jump && !duck) - if(tiles_on_air(TILES_FOR_BUTTJUMP) && jumping) + //if(tiles_on_air(TILES_FOR_BUTTJUMP) && jumping) butt_jump = true; -#endif /* When Down is not held anymore, disable butt jump */ if(butt_jump && !input.down) butt_jump = false; +#if 0 // Do butt jump if (butt_jump && on_ground() && is_big()) { @@ -574,7 +573,6 @@ Player::handle_vertical_input() butt_jump = false; -#if 0 // Break bricks beneath Tux if(Sector::current()->trybreakbrick( Vector(base.x + 1, base.y + base.height), false) @@ -584,9 +582,7 @@ Player::handle_vertical_input() physic.set_velocity_y(2); butt_jump = true; } -#endif -#if 0 // Kill nearby badguys std::vector gameobjects = Sector::current()->gameobjects; for (std::vector::iterator i = gameobjects.begin(); @@ -606,8 +602,8 @@ Player::handle_vertical_input() } } } -#endif } +#endif /** jumping is only allowed if we're about to touch ground soon and if the * button has been up in between the last jump @@ -932,6 +928,7 @@ Player::kill(HurtMode mode) physic.set_acceleration(0, 0); physic.set_velocity(0, 700); player_status->lives -= 1; + player_status->bonus = NO_BONUS; dying = true; dying_timer.start(3.0); flags |= FLAG_NO_COLLDET; @@ -948,6 +945,7 @@ Player::move(const Vector& vector) bbox.set_size(31.8, 31.8); on_ground_flag = false; duck = false; + last_ground_y = vector.y; input.reset(); physic.reset(); diff --git a/src/object/tilemap.h b/src/object/tilemap.h index 2c1960a9f..2ffa8040c 100644 --- a/src/object/tilemap.h +++ b/src/object/tilemap.h @@ -93,7 +93,8 @@ public: } private: - std::vector tiles; + typedef std::vector Tiles; + Tiles tiles; private: TileManager* tilemanager;