From: Ryan Flegel Date: Mon, 17 May 2004 17:01:21 +0000 (+0000) Subject: - some trampoline changes X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=3a242221bb54f60c66895de5d26e164b3c69a6e4;p=supertux.git - some trampoline changes - fixed bug mentioned by Marek in the mailing list (I think) SVN-Revision: 1241 --- diff --git a/src/badguy.cpp b/src/badguy.cpp index 6497e7e03..58154f15c 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -714,7 +714,7 @@ BadGuy::action(double frame_ratio) } // BadGuy fall below the ground - if (base.y > screen->h) { + if (base.y > World::current()->get_level()->height * 32) { remove_me(); return; } diff --git a/src/gameobjs.cpp b/src/gameobjs.cpp index 3a1eeacb6..2d9023485 100644 --- a/src/gameobjs.cpp +++ b/src/gameobjs.cpp @@ -220,9 +220,10 @@ Sprite *img_trampoline[TRAMPOLINE_FRAMES]; void load_object_gfx() { + char sprite_name[16]; + for (int i = 0; i < TRAMPOLINE_FRAMES; i++) { - char sprite_name[16]; sprintf(sprite_name, "trampoline-%i", i+1); img_trampoline[i] = sprite_manager->load(sprite_name); } @@ -257,8 +258,6 @@ Trampoline::action(double frame_ratio) { // TODO: Remove if we're too far off the screen - physic.apply(frame_ratio, base.x, base.y); - // Falling if (mode != M_HELD) { @@ -300,6 +299,9 @@ Trampoline::action(double frame_ratio) base.y = tux.base.y + tux.base.height/1.5 - base.height; } } + + physic.apply(frame_ratio, base.x, base.y); + collision_swept_object_map(&old_base, &base); } void @@ -329,7 +331,7 @@ Trampoline::collision(void *p_c_object, int c_object, CollisionType type) else frame = 0; - if (squish_amount < 24) + if (squish_amount < 20) pplayer_c->physic.set_velocity_y(power); else if (pplayer_c->physic.get_velocity_y() < 0) pplayer_c->physic.set_velocity_y(-squish_amount/32); diff --git a/src/level.cpp b/src/level.cpp index 0a7f7ab5a..f42dd9af8 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -233,7 +233,7 @@ Level::init_defaults() song_title = "Mortimers_chipdisko.mod"; bkgd_image = "arctis.png"; width = 21; - height = 15; + height = 19; start_pos_x = 100; start_pos_y = 170; time_left = 100; diff --git a/src/player.cpp b/src/player.cpp index 93b3cfcce..cdfa36f8f 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -709,7 +709,7 @@ Player::collision(void* p_c_object, int c_object) ptramp_c = (Trampoline*) p_c_object; // Pick up trampoline - if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something) + if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something && on_ground()) { holding_something = true; ptramp_c->mode = Trampoline::M_HELD; @@ -796,7 +796,7 @@ Player::is_dying() bool Player::is_dead() { - if(base.y > screen->h || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling + if(base.y > World::current()->get_level()->height * /*TILE_HEIGHT*/ 32 || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling return true; else return false; @@ -822,7 +822,7 @@ Player::check_bounds(bool back_scrolling, bool hor_autoscroll) } /* Keep in-bounds, vertically: */ - if (base.y > screen->h) + if (base.y > sWorld::current()->get_level()->height * /*TILE_HEIGHT*/ 32) { kill(KILL); }