Ejemplo n.º 1
0
int Game_Character::GetScreenY() const {
	int y = GetRealY() / TILE_SIZE - Game_Map::GetDisplayY() / TILE_SIZE + TILE_SIZE;

	if (Game_Map::LoopVertical()) {
		int map_height = Game_Map::GetHeight() * TILE_SIZE;
		y = (y + map_height) % map_height;
	}

	if (IsJumping()) {
		int jump_height = (remaining_step > SCREEN_TILE_WIDTH / 2 ? SCREEN_TILE_WIDTH - remaining_step : remaining_step) / 8;
		y -= (jump_height < 5 ? jump_height * 2 : jump_height < 13 ? jump_height + 4 : 16);
	}

	return y;
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
int Entity::CheckWorldBBox(Rect box) {
	return BBox::CheckWorldBBox(GetRealX(), GetRealY(), box);
}
Ejemplo n.º 4
0
BBox::Rect Entity::GetWorldBBox() {
	return BBox::GetWorldBBox(GetRealX(), GetRealY());
}
Ejemplo n.º 5
0
void Entity::Update(int iDelta) {
	Origin::Update(iDelta);

	SetX( (int)GetRealX() );
	SetY( (int)GetRealY() );
}