So my collision detection for the player is this:
public void update(Input input) {
if(input.isKeyDown(Keyboard.KEY_UP) && !bounds.instersects(anycollisions)) {
y--;
}
if(input.isKeyDown(Keyboard.KEY_DOWN) && !bounds.instersects(anycollisions)) {
y++;
}
if(input.isKeyDown(Keyboard.KEY_LEFT) && !bounds.instersects(anycollisions)) {
x--;
}
if(input.isKeyDown(Keyboard.KEY_RIGHT) && !bounds.instersects(anycollisions)) {
x++;
}
}
When I hit something I will just stop moving completely. I know why it’s happening. However I don’t know any other ways of doing collision detection. Is there any other way that I can still use bounding boxes? What I need is a way for the collision to involve direction somehow. I just don’t know how I could implement that.