void entity::add_to_level() { last_move_x_ = last_move_y_ = 0; prev_feet_x_ = prev_feet_y_ = INT_MIN; prev_platform_rect_ = rect(); calculate_solid_rect(); }
bool entity::move_centipixels(int dx, int dy) { int start_x = x(); int start_y = y(); x_ += dx; y_ += dy; if(x() != start_x || y() != start_y) { calculate_solid_rect(); return true; } else { return false; } }
void entity::set_face_right(bool facing) { if(facing == face_right_) { return; } const int start_x = feet_x(); face_right_ = facing; const int delta_x = feet_x() - start_x; x_ -= delta_x*100; assert(feet_x() == start_x); calculate_solid_rect(); }
void set_centi_y(int y) { y_ = y; calculate_solid_rect(); }
void set_centi_x(int x) { x_ = x; calculate_solid_rect(); }
void set_y(int y) { y_ = y*100; calculate_solid_rect(); }
void set_x(int x) { x_ = x*100; calculate_solid_rect(); }
void set_pos(int x, int y) { x_ = x*100; y_ = y*100; calculate_solid_rect(); }
void set_pos(const point& p) { x_ = p.x*100; y_ = p.y*100; calculate_solid_rect(); }
virtual void shift_position(int x, int y) { x_ += x*100; y_ += y*100; prev_feet_x_ += x; prev_feet_y_ += y; calculate_solid_rect(); }