From: Marek Moeckel Date: Thu, 25 Nov 2004 14:38:07 +0000 (+0000) Subject: fixed a couple of nolok's minor bugs X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=658b21a109e7f72cac5530fa1eb9652bcf3e3047;p=supertux.git fixed a couple of nolok's minor bugs SVN-Revision: 2187 --- diff --git a/data/images/supertux.strf b/data/images/supertux.strf index 85c185e7d..d29f8712c 100644 --- a/data/images/supertux.strf +++ b/data/images/supertux.strf @@ -1126,38 +1126,38 @@ (action (name "left") (x-offset 0) - (y-offset 32) + (y-offset 0) (images "shared/dummyguy-walk-1.png" "shared/dummyguy-walk-2.png")) (action (name "right") (x-offset 0) - (y-offset 32) + (y-offset 0) (mirror-action "left")) (action (name "stand") (x-offset 0) - (y-offset 32) + (y-offset 0) (images "shared/dummyguy-stand.png")) (action (name "throw") (x-offset 0) - (y-offset 32) + (y-offset 0) (images "shared/dummyguy-throw.png")) (action (name "jump") (x-offset 0) - (y-offset 32) + (y-offset 0) (images "shared/dummyguy-jump.png")) (action (name "dead") (x-offset 0) - (y-offset 32) + (y-offset 0) (images "shared/dummyguy-dead.png"))) diff --git a/data/levels/test/noloktest.stl b/data/levels/test/noloktest.stl index 3d5ca7025..f1f1e74af 100644 --- a/data/levels/test/noloktest.stl +++ b/data/levels/test/noloktest.stl @@ -11,7 +11,7 @@ (background (image "forest1.jpg") (speed 0.5)) (music "Mortimers_chipdisko.mod") - (spawn-points (name "main") (x 100) (y 512)) + (spawn-points (name "main") (x 100) (y 100)) (nolok_01 (x 650) (y 512)) (tilemap (layer "background") diff --git a/src/badguy/nolok_01.cpp b/src/badguy/nolok_01.cpp index 180ee839d..69a91ddd5 100644 --- a/src/badguy/nolok_01.cpp +++ b/src/badguy/nolok_01.cpp @@ -4,19 +4,20 @@ #include "badguy/bouncing_snowball.h" #include "trigger/door.h" -#define SHOOT_TIME 2.5 -#define IDLE_TIME 0.4 +#define WALK_TIME 2.5 +#define SHOOT_TIME 0.4 #define JUMP_TIME 0.3 -static const float WALKSPEED = 80; +static const float WALKSPEED = 90; //TODO: Create sprite, give multiple hitpoints, limit max number of snowballs // Can only be killed when jumping, no idea why +// Stop actions when pause button is hit (probably a general problem of timers) Nolok_01::Nolok_01(LispReader& reader) { reader.read_float("x", start_position.x); reader.read_float("y", start_position.y); - bbox.set_size(31.8, 31.8); + bbox.set_size(31.8, 63.8); sprite = sprite_manager->create("dummyguy"); } @@ -24,7 +25,7 @@ Nolok_01::Nolok_01(float pos_x, float pos_y) { start_position.x = pos_x; start_position.y = pos_y; - bbox.set_size(31.8, 31.8); + bbox.set_size(31.8, 63.8); sprite = sprite_manager->create("dummyguy"); } @@ -45,7 +46,7 @@ Nolok_01::activate() physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED); sprite->set_action(dir == LEFT ? "left" : "right"); action = WALKING; - action_timer.start(SHOOT_TIME); + action_timer.start(WALK_TIME); } void @@ -60,16 +61,16 @@ Nolok_01::active_action(float elapsed_time) } else if (action == JUMPING) { sprite->set_action("throw"); - action = IDLE; - action_timer.start(IDLE_TIME); + action = SHOOTING; + action_timer.start(SHOOT_TIME); } - else if (action == IDLE) { - Sector::current()->add_object(new BouncingSnowball(get_pos().x-32, get_pos().y, LEFT)); - Sector::current()->add_object(new BouncingSnowball(get_pos().x, get_pos().y, RIGHT)); + else if (action == SHOOTING) { + Sector::current()->add_object(new BouncingSnowball(get_pos().x - 64, get_pos().y, LEFT)); + Sector::current()->add_object(new BouncingSnowball(get_pos().x + 64, get_pos().y, RIGHT)); physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED); sprite->set_action(dir == LEFT ? "left" : "right"); action = WALKING; - action_timer.start(SHOOT_TIME); + action_timer.start(WALK_TIME); } } }