|
|
|
@ -12,6 +12,8 @@ |
|
|
|
|
|
|
|
|
|
using namespace olc; |
|
|
|
|
|
|
|
|
|
extern std::vector<Object*> OBJECTS; |
|
|
|
|
|
|
|
|
|
struct Interaction{ |
|
|
|
|
std::vector<std::string> messages={}; |
|
|
|
|
Item*item=nullptr; |
|
|
|
@ -53,7 +55,18 @@ class Object{ |
|
|
|
|
bool Collision(vd2d pos) { |
|
|
|
|
GAME->SetDrawTarget(layer::COLLISION); |
|
|
|
|
Pixel collisionData = GAME->GetDrawTarget()->GetPixel((int)pos.x-cameraPos.x,(int)pos.y-cameraPos.y); |
|
|
|
|
return collisionData!=MAGENTA; |
|
|
|
|
if (collisionData!=MAGENTA) { |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
for (int i=0;i<OBJECTS.size();i++) { |
|
|
|
|
if (OBJECTS[i]!=this) { |
|
|
|
|
if (std::abs(OBJECTS[i]->GetPosWithOrigin().x-pos.x)+std::abs(OBJECTS[i]->GetPosWithOrigin().y-pos.y)<4) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
//A grid version of the constructor. used ONLY for battle setups.
|
|
|
|
|
Object(int id,std::string name,int gridx,int gridy,Animation*spr,vd2d scale={1,1},Pixel color=WHITE,int animationSpd=1,bool temp=false,ObjectExtraData data={moveTime:0,moveFreq:0,moveSpd:0}) |
|
|
|
|