I'm working on a game for a game jam, and can't get my collision system to work. The way it's supposed to work is when an the player intersects with a wall hitbox it moves the player towards the last position until it no longer intersects. This doesn't work though, this is the code:`
while(worldBox.intersects((Rectangle2D) Player.entity)) {
if(offsetX - lastX > 0) offsetX --;
if(offsetX - lastX < 0) offsetX ++;
if(offsetY - lastY > 0) offsetY --;
if(offsetY - lastY < 0) offsetY ++;
makeWorldHitBox();
}
` and here is the link to the github repo: https://github.com/DJPretzel-bit64/LemonRunner.git
I tried changing sines and offsets, nothing worked