I am working on a AABB collision detection function. I am getting a “expression must have class type” on my “one” variable in my checkCollision function. I have googled this error and have looked at other sites but with no luck on finding an answer. I am learning about pointers and passing by reference. here is my short piece of code.
#include<iostream>
using namespace std;
bool CheckCollision(GameObject &one, GameObject &two); // AABB - AABB collision
class GameObject
{
public:
int Position;
int Size;
int x;
int y;
};
int main()
{
GameObject one,two;
one.x = 0;
one.y = 0;
one.Position = 0;
one …