|
|
|
@ -70,15 +70,16 @@ class Animation{ |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class Object{ |
|
|
|
|
private: |
|
|
|
|
vd2d scale={1,1}; |
|
|
|
|
public: |
|
|
|
|
int id; |
|
|
|
|
Animation*spr; |
|
|
|
|
vd2d pos; |
|
|
|
|
int frameIndex=0; |
|
|
|
|
int frameCount=0; |
|
|
|
|
int animationSpd=12; //How many frames to wait between each frame.
|
|
|
|
|
int animationSpd=12; //How many frames to wait between each frame. Setting to 0 pauses the animation.
|
|
|
|
|
std::string name; |
|
|
|
|
vd2d scale={1,1}; |
|
|
|
|
Pixel color=WHITE; |
|
|
|
|
vd2d originPoint={0,0}; |
|
|
|
|
bool drawn=false; |
|
|
|
@ -101,6 +102,9 @@ class Object{ |
|
|
|
|
this->scale=scale; |
|
|
|
|
this->originPoint={spr->width/2*scale.x,(spr->spr->sprite->height-4)*scale.y}; |
|
|
|
|
} |
|
|
|
|
vd2d GetScale() { |
|
|
|
|
return scale; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class SeasonI : public PixelGameEngine |
|
|
|
@ -198,11 +202,13 @@ public: |
|
|
|
|
}), |
|
|
|
|
(CutsceneAction*)new Fade(true), |
|
|
|
|
(CutsceneAction*)new SetFlagWhenCutsceneEnds(Flag::TEST_FLAG1), |
|
|
|
|
(CutsceneAction*)new PanCamera({128,128},BOTH), |
|
|
|
|
(CutsceneAction*)new PanCamera({128,128},BOTH,1), |
|
|
|
|
(CutsceneAction*)new MoveCutsceneObjectAsync(1,{80,64},5), |
|
|
|
|
(CutsceneAction*)new PanCamera({64,0},BOTH), |
|
|
|
|
(CutsceneAction*)new MoveCutsceneObject(1,{80,64}), |
|
|
|
|
(CutsceneAction*)new DialogBox(R"(Hello! |
|
|
|
|
This is a test message that lets us trigger straight from a cutscene! Cool!)"),}); |
|
|
|
|
(CutsceneAction*)new DialogBoxAsync(R"(Hello! |
|
|
|
|
This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
(CutsceneAction*)new ModifyObject(0,ANIMATIONS["player.png"],{5,5},MAGENTA), |
|
|
|
|
(CutsceneAction*)new MoveCutsceneObject(1,{320,64},1),}); |
|
|
|
|
/*DisplayMessageBox(R"(Hello World!
|
|
|
|
|
This is a rather long message, but I hope it reaches you well
|
|
|
|
|
in some form or capacity or another. Even though it
|
|
|
|
@ -298,7 +304,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
case ActionType::CREATE_OBJECTS:{ |
|
|
|
|
for (auto&obj:((CreateObjects*)CurrentCutscene->GetAction())->GetObjects()) { |
|
|
|
|
obj->temp=true; |
|
|
|
|
AddObjectToWorld(CurrentCutscene->AddCutsceneObject(new Object(obj->id,obj->name,obj->pos,obj->spr,obj->scale,obj->color,obj->animationSpd,true))); |
|
|
|
|
AddObjectToWorld(CurrentCutscene->AddCutsceneObject(new Object(obj->id,obj->name,obj->pos,obj->spr,obj->GetScale(),obj->color,obj->animationSpd,true))); |
|
|
|
|
} |
|
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
|
}break; |
|
|
|
@ -346,6 +352,18 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
DisplayMessageBox(((DialogBox*)CurrentCutscene->GetAction())->GetMessage()); |
|
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
|
}break; |
|
|
|
|
case ActionType::MODIFY_OBJECT:{ |
|
|
|
|
ModifyObject*action=(ModifyObject*)CurrentCutscene->GetAction(); |
|
|
|
|
Object*obj=CurrentCutscene->GetCutsceneObjects()[action->GetCutsceneObjID()]; |
|
|
|
|
obj->SetScale(action->GetObjScale()); |
|
|
|
|
obj->color=action->GetObjCol(); |
|
|
|
|
obj->spr=action->GetObjSpr(); |
|
|
|
|
if (action->GetFrameIndex()!=-1) { |
|
|
|
|
obj->frameIndex=action->GetFrameIndex(); |
|
|
|
|
} |
|
|
|
|
obj->animationSpd=action->GetAnimationSpeed(); |
|
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i=0;i<CUTSCENE_QUEUE.size();i++) { |
|
|
|
@ -625,7 +643,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
if (!obj->drawn&&obj->pos.y+obj->originPoint.y>(y+yTileOffset)*32&&obj->pos.y+obj->originPoint.y<=(y+yTileOffset+1)*32) { |
|
|
|
|
obj->drawn=true; |
|
|
|
|
SetDrawTarget(layer::DYNAMIC); |
|
|
|
|
DrawPartialDecal(obj->pos-cameraPos,obj->spr->spr,{(obj->frameIndex%obj->spr->frames)*obj->spr->width,0},{obj->spr->width,obj->spr->spr->sprite->height},obj->scale,obj->color); |
|
|
|
|
DrawPartialDecal(obj->pos-cameraPos,obj->spr->spr,{(obj->frameIndex%obj->spr->frames)*obj->spr->width,0},{obj->spr->width,obj->spr->spr->sprite->height},obj->GetScale(),obj->color); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int x=-1;x<WIDTH/32+2;x++) { |
|
|
|
@ -928,7 +946,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
//You're probably trying to add an object to the world. Use this function inside of AddObjectToWorld(CreateObject(...))
|
|
|
|
|
//You only need to use this function if you want to create an object from pre-defined OBJ_INFO variables.
|
|
|
|
|
Object*CreateObject(int id,vd2d pos) { |
|
|
|
|
return new Object(id,OBJ_INFO[id]->name,pos,OBJ_INFO[id]->spr,OBJ_INFO[id]->scale,OBJ_INFO[id]->color,OBJ_INFO[id]->animationSpd); |
|
|
|
|
return new Object(id,OBJ_INFO[id]->name,pos,OBJ_INFO[id]->spr,OBJ_INFO[id]->GetScale(),OBJ_INFO[id]->color,OBJ_INFO[id]->animationSpd); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Object*CreateObjectInfo(Reference ref,std::string name,vd2d pos,std::string spriteFileName,int sprWidth,vd2d scale={1,1},Pixel tint=WHITE,Flag enableFlag=Flag::NONE,Flag disableFlag=Flag::NONE,int animationDelay=1) { |
|
|
|
|