if(ice_state == ICESTATE_GRABBED)
return FORCE_MOVE;
+ if(dir == UP) {
+ return FORCE_MOVE;
+ }
+
// handle kicks from left or right side
if(ice_state == ICESTATE_FLAT && get_state() == STATE_ACTIVE) {
if(hit.left) {
WalkingBadguy::activate();
break;
case ICESTATE_FLAT:
- sound_manager->play("sounds/stomp.wav", get_pos());
- physic.set_velocity_x(0);
- physic.set_velocity_y(0);
-
- sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
+ if(dir == UP) {
+ physic.set_velocity_y(-KICKSPEED);
+ bbox.set_size(34, 31.8f);
+ } else {
+ sound_manager->play("sounds/stomp.wav", get_pos());
+ physic.set_velocity_x(0);
+ physic.set_velocity_y(0);
+
+ sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
+ }
flat_timer.start(4);
break;
case ICESTATE_KICKED:
MrIceBlock::ungrab(MovingObject& , Direction dir)
{
this->dir = dir;
- set_state(ICESTATE_KICKED);
+ set_state(dir == UP ? ICESTATE_FLAT : ICESTATE_KICKED);
set_group(COLGROUP_MOVING);
}
#ifndef SUPERTUX_DIRECTION_H
#define SUPERTUX_DIRECTION_H
-enum Direction { AUTO, LEFT, RIGHT };
+enum Direction { AUTO, LEFT, RIGHT, UP, DOWN };
#endif
#include "video/drawing_context.hpp"
#include "lisp/lisp.hpp"
#include "gameobjs.hpp"
+#include "portable.hpp"
#include "specialriser.hpp"
#include "growup.hpp"
#include "flower.hpp"
}
}
- if(bouncing) {
+ Portable* portable = dynamic_cast<Portable*> (&other);
+ if(bouncing && (portable == 0 || portable->is_portable())) {
BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
if(badguy) {
badguy->kill_fall();
try_open();
}
}
+ Portable* portable = dynamic_cast<Portable*> (&other);
+ if(portable) {
+ MovingObject* moving = dynamic_cast<MovingObject*> (&other);
+ if(moving->get_bbox().get_top() > get_bbox().get_bottom() - 7.0) {
+ try_open();
+ }
+ }
return Block::collision(other, hit);
}
try_break(false);
}
}
+ Portable* portable = dynamic_cast<Portable*> (&other);
+ if(portable) {
+ MovingObject* moving = dynamic_cast<MovingObject*> (&other);
+ if(moving->get_bbox().get_top() > get_bbox().get_bottom() - 7.0) {
+ try_break();
+ }
+ }
return Block::collision(other, hit);
}
if( controller->released( Controller::PEEK_RIGHT ) ) {
peeking = AUTO;
}
+ if( controller->released( Controller::UP ) ) {
+ peeking = AUTO;
+ }
+ if( controller->released( Controller::DOWN ) ) {
+ peeking = AUTO;
+ }
if( controller->pressed( Controller::PEEK_LEFT ) ) {
peeking = LEFT;
}
if( controller->pressed( Controller::PEEK_RIGHT ) ) {
peeking = RIGHT;
}
+ if( controller->pressed( Controller::UP ) ) {
+ peeking = UP;
+ }
+ if( controller->pressed( Controller::DOWN ) ) {
+ peeking = DOWN;
+ }
/* Handle horizontal movement: */
if (!backflipping) handle_horizontal_input();
if(moving_object) {
moving_object->set_pos(pos);
} else {
- log_debug << "Non MovingObjetc grabbed?!?" << std::endl;
+ log_debug << "Non MovingObject grabbed?!?" << std::endl;
+ }
+ if(controller->hold(Controller::UP)) {
+ grabbed_object->ungrab(*this, UP);
+ } else {
+ grabbed_object->ungrab(*this, dir);
}
- grabbed_object->ungrab(*this, dir);
grabbed_object = NULL;
}
}
{
set_group(COLGROUP_MOVING_STATIC);
on_ground = false;
- if (last_movement.norm() > 1) {
+ if(dir == UP) {
+ physic.set_velocity(0, -500);
+ } else if (last_movement.norm() > 1) {
physic.set_velocity((dir == RIGHT) ? 200 : -200, -200);
} else {
physic.set_velocity(0, 0);