When a big icecrusher is used, the camera shakes more, the up movement is
slower and the timeouts are longer.
SVN-Revision: 6627
--- /dev/null
+(supertux-sprite
+ (action
+ (name "idle")
+ (hitbox 2 0 128 128)
+ (images "krosh.png"
+ )
+ )
+ (action
+ (name "crushing")
+ (hitbox 2 0 128 128)
+ (images "krosh.png"
+ )
+ )
+ (action
+ (name "recovering")
+ (hitbox 2 0 128 128)
+ (images "krosh.png"
+ )
+ )
+)
#include "badguy/badguy.hpp"
#include "sprite/sprite.hpp"
#include "object/player.hpp"
#include "badguy/badguy.hpp"
#include "sprite/sprite.hpp"
#include "object/player.hpp"
+#include "object/camera.hpp"
#include "supertux/object_factory.hpp"
#include "supertux/sector.hpp"
namespace {
/* Maximum movement speed in pixels per LOGICAL_FPS */
const float MAX_DROP_SPEED = 10.0;
#include "supertux/object_factory.hpp"
#include "supertux/sector.hpp"
namespace {
/* Maximum movement speed in pixels per LOGICAL_FPS */
const float MAX_DROP_SPEED = 10.0;
-const float RECOVER_SPEED = -3.125;
+const float RECOVER_SPEED_NORMAL = -3.125;
+const float RECOVER_SPEED_LARGE = -2.0;
const float DROP_ACTIVATION_DISTANCE = 4.0;
const float DROP_ACTIVATION_DISTANCE = 4.0;
-const float PAUSE_TIME = 0.5;
+const float PAUSE_TIME_NORMAL = 0.5;
+const float PAUSE_TIME_LARGE = 1.0;
}
IceCrusher::IceCrusher(const Reader& reader) :
}
IceCrusher::IceCrusher(const Reader& reader) :
state(IDLE),
start_position(),
physic(),
state(IDLE),
start_position(),
physic(),
+ cooldown_timer(0.0),
+ ic_size(NORMAL)
{
start_position = get_bbox().p1;
set_state(state, true);
{
start_position = get_bbox().p1;
set_state(state, true);
+
+ float sprite_width = sprite->get_width ();
+ log_debug << "My width is " << sprite_width;
+ if (sprite_width >= 128.0)
+ ic_size = LARGE;
break;
case CRUSHING:
if (hit.bottom) {
break;
case CRUSHING:
if (hit.bottom) {
- cooldown_timer = PAUSE_TIME;
+ if (ic_size == LARGE) {
+ cooldown_timer = PAUSE_TIME_LARGE;
+ Sector::current()->camera->shake (/* frequency = */ .125f, /* x = */ 0.0, /* y = */ 16.0);
+ }
+ else {
+ cooldown_timer = PAUSE_TIME_NORMAL;
+ Sector::current()->camera->shake (/* frequency = */ .1f, /* x = */ 0.0, /* y = */ 8.0);
+ }
set_state(RECOVERING);
}
break;
set_state(RECOVERING);
}
break;
if (get_bbox().p1.y <= start_position.y+1) {
set_pos(start_position);
movement = Vector (0, 0);
if (get_bbox().p1.y <= start_position.y+1) {
set_pos(start_position);
movement = Vector (0, 0);
- cooldown_timer = PAUSE_TIME;
+ if (ic_size == LARGE)
+ cooldown_timer = PAUSE_TIME_LARGE;
+ else
+ cooldown_timer = PAUSE_TIME_NORMAL;
set_state(IDLE);
}
else {
set_state(IDLE);
}
else {
- movement = Vector (0, RECOVER_SPEED);
+ if (ic_size == LARGE)
+ movement = Vector (0, RECOVER_SPEED_LARGE);
+ else
+ movement = Vector (0, RECOVER_SPEED_NORMAL);
bool found_victim();
void set_state(IceCrusherState state, bool force = false);
bool found_victim();
void set_state(IceCrusherState state, bool force = false);
+private:
+ enum IceCrusherSize {
+ NORMAL,
+ LARGE
+ };
+ IceCrusherSize ic_size;