update();
if((int)frame >= get_frames() || (int)frame < 0)
- log_warning << "frame out of range: " << (int)frame << "/" << get_frames() << " at " << get_name() << "/" << get_action_name() << std::endl;
+ log_warning << "frame out of range: " << (int)frame << "/" << get_frames() << " at " << get_name() << "/" << get_action() << std::endl;
else
context.draw_surface(action->surfaces[(int)frame],
pos - Vector(action->x_offset, action->y_offset),
#ifndef DEBUG
// in optimized mode we get some small rounding errors in floating point
// number sometimes...
- log_warning << "frame out of range: " << frameidx << "/" << get_frames() << " at sprite: " << get_name() << "/" << get_action_name() << std::endl;
+ log_warning << "frame out of range: " << frameidx << "/" << get_frames() << " at sprite: " << get_name() << "/" << get_action() << std::endl;
#endif
frameidx = get_frames() - 1;
}
return (int) action->surfaces[get_frame()]->get_height();
}
+float
+Sprite::get_current_hitbox_x_offset() const
+{
+ return action->x_offset;
+}
+
+float
+Sprite::get_current_hitbox_y_offset() const
+{
+ return action->y_offset;
+}
+
+float
+Sprite::get_current_hitbox_width() const
+{
+ return action->hitbox_w;
+}
+
+float
+Sprite::get_current_hitbox_height() const
+{
+ return action->hitbox_h;
+}
+
+Rect
+Sprite::get_current_hitbox() const
+{
+ return Rect(action->x_offset, action->y_offset, action->x_offset + action->hitbox_w, action->y_offset + action->hitbox_h);
+}
+
void
Sprite::set_fps(float new_fps)
{