Using Rectangle.Intersects for Collision detection causes objects to “stick” to surfaces (Java)
1 1 I am trying to develop a top - down shooter game. Currently I am doing everything from scratch because I want to learn Java better. My problem right now is with collision detection. I am using Rectangle.Intersects(as seen in code) to determine whether the player is intersecting with walls. It almost perfectly, except that when the player is colliding on just one axis (ie running into a vertical wall), they are locked in both directions. I want to implement sliding for more smooth gameplay. I have a slight idea on how to do this, which would involve checking the x and y planes individually. However, I don't know if this is possible using my current method. I am a little new to Java so I don't know much about different kinds of libraries I could use instead of Rectangles but they have been working great and I would like to stick to them. If there is a solution using Rectangles, that would be great. If there isn't, I'm open to new ideas. Thanks. Here is t