|
|
@ -3,6 +3,8 @@ |
|
|
|
#include "pixelGameEngine.h" |
|
|
|
#include "pixelGameEngine.h" |
|
|
|
#include "flags.h" |
|
|
|
#include "flags.h" |
|
|
|
#include "animation.h" |
|
|
|
#include "animation.h" |
|
|
|
|
|
|
|
#include "defines.h" |
|
|
|
|
|
|
|
#include "layers.h" |
|
|
|
using namespace olc; |
|
|
|
using namespace olc; |
|
|
|
|
|
|
|
|
|
|
|
class Object{ |
|
|
|
class Object{ |
|
|
@ -28,7 +30,11 @@ class Object{ |
|
|
|
int blinkFrames=0; //Frame count of how much time is left for the image to be blinking. Used when enemies take damage.
|
|
|
|
int blinkFrames=0; //Frame count of how much time is left for the image to be blinking. Used when enemies take damage.
|
|
|
|
//animationSpd is how long to wait before switching frames.
|
|
|
|
//animationSpd is how long to wait before switching frames.
|
|
|
|
bool highlighted=false; //Whether or not this object has been declared as highlighted by a target range selector.
|
|
|
|
bool highlighted=false; //Whether or not this object has been declared as highlighted by a target range selector.
|
|
|
|
bool Collision(vd2d pos); |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
//A grid version of the constructor. used ONLY for battle setups.
|
|
|
|
//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) |
|
|
|
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) |
|
|
|
:Object(id,name,{gridx*32-(spr->width*0.5)*(scale.x-1),gridy*32-(spr->spr->sprite->height-4)*(scale.y-1)},spr,scale,color,animationSpd,temp) {} |
|
|
|
:Object(id,name,{gridx*32-(spr->width*0.5)*(scale.x-1),gridy*32-(spr->spr->sprite->height-4)*(scale.y-1)},spr,scale,color,animationSpd,temp) {} |
|
|
|