A repository that sets up a C++ Project with the olcPixelGameEngine already loaded.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
504 B

#define OLC_PGE_APPLICATION
#include "pixelGameEngine.h"
class Object{
public:
olc::vd2d pos;
Object(olc::vd2d pos)
:pos(pos) {}
virtual bool collidesWidth(Object&obj);
};
class NPC:public Object{
olc::vd2d size;
NPC(olc::vd2d pos,olc::vd2d size)
:Object(pos),size(size) {}
bool collidesWidth(Object&obj)override{
return obj.pos.x>=pos.x&&obj.pos.x<=pos.x+size.x
&& obj.pos.y>=pos.y&&obj.pos.y<=pos.y+size.y;
}
}
int main() {
return 0;
}