pbivens67 said:
well, are there any good tutorials on AABB collision detection with multiple boxes?
You already had a first function, which looked like working.
Then you added a second way, by adopting my example of using a AABox class, which now should work.
A tutorial can be about two things: 1. The math and logic of an intersection test 2. potential solutions an the many bodies problem. That was all covered here.
What exactly is your problem so now you work on a third way to do this intersection test?
The issue is this:
pbivens67 said:
// collision x-axis? bool collisionX = one.Position.x +
Position has a x member variable, so likely they use a 2D vector class for their position. Exactly the same as with my AABox class, which used vec2 as well. And you have correctly replaced this with an array of two floats.
But here you did this:
pbivens67 said:
class GameObject { public: int x; int y; int Position;
You have x and y. Which is position.
But you also have a one dimensional Position variable as well, which can't describe the position in 2D space needed for a box.
So you either need to use x and y, changing the intersection code accordingly.
Or you have to make the Position variable a float Position[2], and replace .x and .y of the intersection code with array indices.
Or you spare all this redundant work, which you already did before two times. Because you already have two intersection methods which both should work.
I can help you, but for that you need to answer my questions:
JoeJ said:
Idk what's the state of your game, but i guess you have 5 x 8 bugs on screen already? And some moving bullet? From there it shouldn't be hard to add some collision response.
My intend here is: You show what you have, then i can propose how to add collision response.
Basically i need to see how you create your bugs, what's their data structures and related code.