Beispiel #1
0
void Child::reflect(Wall w) {
	if (get_pos() >= w.get_min() && get_pos() <= w.get_max()) //kill the child
		die();
	else if (is_horizantal_collision())
			delta_info.vel.y += -2* get_vel().y;
	else if (is_vertical_collision())
			delta_info.vel.x += -2* get_vel().x;
}
Beispiel #2
0
bool is_vertical_collision(Wall w) {
	if(get_pos().y >= w.get_min().y && get_pos().y <= w.get_max().y)
		if (get_pos.x >= w.get_min().x - get_radius() && get_pos.x <= w.get_max().x + get_radius())
			return true;
	return false;
}
Beispiel #3
0
bool is_horizantal_collision(Wall w) {
	if(get_pos().x >= w.get_min().x && get_pos().x <= w.get_max().x)
		if (get_pos.y >= w.get_min().y - get_radius() && get_pos.y <= w.get_max().y + get_radius())
			return true;
	return false;
}