int Game_Character::GetScreenX() const { int x = GetRealX() / TILE_SIZE - Game_Map::GetDisplayX() / TILE_SIZE + (TILE_SIZE / 2); if (Game_Map::LoopHorizontal()) { int map_width = Game_Map::GetWidth() * TILE_SIZE; x = (x + map_width) % map_width; } return x; }
void Game_Player::Center() { int x = GetRealX() + SCREEN_TILE_WIDTH; int y = GetRealY() + SCREEN_TILE_WIDTH / 2; int dist_to_screen_left = -SCREEN_WIDTH / 2; int dist_to_screen_top = -SCREEN_HEIGHT / 2; Game_Map::AddScreenX(x, dist_to_screen_left); Game_Map::AddScreenY(y, dist_to_screen_top); actual_pan_x = Game_Map::GetPanX(); actual_pan_y = Game_Map::GetPanY(); Game_Map::AddScreenX(x, actual_pan_x); Game_Map::AddScreenY(y, actual_pan_y); Game_Map::SetPositionX(x); Game_Map::SetPositionY(y); }
int Entity::CheckWorldBBox(Rect box) { return BBox::CheckWorldBBox(GetRealX(), GetRealY(), box); }
BBox::Rect Entity::GetWorldBBox() { return BBox::GetWorldBBox(GetRealX(), GetRealY()); }
void Entity::Update(int iDelta) { Origin::Update(iDelta); SetX( (int)GetRealX() ); SetY( (int)GetRealY() ); }