From 658b21a109e7f72cac5530fa1eb9652bcf3e3047 Mon Sep 17 00:00:00 2001 From: Marek Moeckel Date: Thu, 25 Nov 2004 14:38:07 +0000 Subject: [PATCH] fixed a couple of nolok's minor bugs SVN-Revision: 2187 --- data/images/supertux.strf | 12 ++++++------ data/levels/test/noloktest.stl | 2 +- src/badguy/nolok_01.cpp | 25 +++++++++++++------------ 3 files changed, 20 insertions(+), 19 deletions(-) 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); } } } -- 2.11.0