void entity::process(level& lvl) { if(prev_feet_x_ != INT_MIN) { last_move_x_ = feet_x() - prev_feet_x_; last_move_y_ = feet_y() - prev_feet_y_; } prev_feet_x_ = feet_x(); prev_feet_y_ = feet_y(); prev_platform_rect_ = platform_rect_; }
int entity::last_move_y() const { if(prev_feet_y_ == INT_MIN) { return 0; } return feet_y() - prev_feet_y_; }
void entity::draw_debug_rects() const { if(preferences::show_debug_hitboxes() == false) { return; } const rect& body = solid_rect(); if(body.w() > 0 && body.h() > 0) { const SDL_Rect rect = { body.x(), body.y(), body.w(), body.h() }; graphics::draw_rect(rect, graphics::color_black(), 0xAA); } const rect& hit = hit_rect(); if(hit.w() > 0 && hit.h() > 0) { const SDL_Rect rect = { hit.x(), hit.y(), hit.w(), hit.h() }; graphics::draw_rect(rect, graphics::color_red(), 0xAA); } const SDL_Rect rect = { feet_x() - 1, feet_y() - 1, 3, 3 }; graphics::draw_rect(rect, graphics::color_white(), 0xFF); }
void entity::process(level& lvl) { prev_feet_x_ = feet_x(); prev_feet_y_ = feet_y(); prev_platform_rect_ = platform_rect_; }