Can someone help me with my collisons they don't work very well

float vX = (x + (sz / 2)) - (plx + (plw / 2)),
	vY = (y + (sz / 2)) - (ply + (plh / 2)),
	hWidths = (sz / 2) + (plw / 2),
	hHeights = (sz / 2) + (plh / 2);

if (abs(vX) < hWidths && abs(vY) < hHeights) {
	float oX = hWidths - abs(vX),
		oY = hHeights - abs(vY);
	if (oX >= oY) {
		if (vY > 0) {
			y += oY;
		}
		else {
			ground = true;
			y -= oY;
		}
	}
	else {
		if (vX > 0) {
			x += oX;
		}
		else {
			x -= oX;
		}
	}
}

}

Hello, to have more chances to receive an answer, you should describe what you want to achieve, describe what you have tried, and describe the problem that are you having :wink:

1 Like