Align battle encounters to grid

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 328d5480f7
commit ca4134fbb9
  1. BIN
      C++ProjectTemplate
  2. 9
      main.cpp

Binary file not shown.

@ -110,7 +110,7 @@ class Object{
}
//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(id,name,{gridx*32-(spr->width*0.5)*(scale.x-1),gridy*32-(spr->spr->sprite->height)*(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) {}
Object(int id,std::string name,vd2d pos,Animation*spr,vd2d scale={1,1},Pixel color=WHITE,int animationSpd=1,bool temp=false) {
this->spr=spr;
this->pos=pos;
@ -1614,7 +1614,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
pixelOffsetY=0;
}
SetDrawTarget(layer::DYNAMIC);
DrawPartialDecal(obj->GetPos()-cameraPos,obj->spr->spr,{(float)((obj->frameIndex%obj->spr->frames)*obj->spr->width),0},{(float)obj->spr->width,(float)obj->spr->spr->sprite->height},obj->GetScale(),obj->color);
DrawPartialDecal(obj->GetPos()-cameraPos,obj->spr->spr,{(float)((obj->frameIndex%obj->spr->frames)*obj->spr->width),0},{(float)obj->spr->width,(float)obj->spr->spr->sprite->height},obj->GetScale(),Pixel(obj->color.r,obj->color.g,obj->color.b,abs(sin(M_PI/60*frameCount)*210)));
} else {
SetDrawTarget(layer::DYNAMIC);
DrawPartialDecal(obj->GetPos()-cameraPos,obj->spr->spr,{(float)((obj->frameIndex%obj->spr->frames)*obj->spr->width),0},{(float)obj->spr->width,(float)obj->spr->spr->sprite->height},obj->GetScale(),obj->color);
@ -2522,7 +2522,8 @@ goes on a very long time, I hope you can understand this is only for testing pur
for (int i=PARTY_TRAIL_LENGTH-1;i>0;i--) {
partyTrail[i]=partyTrail[i-1];
}
partyTrail[0]=PARTY_MEMBER_OBJ[0]->GetPos()-newMovement;
partyTrail[0]={PARTY_MEMBER_OBJ[0]->GetPos().x-newMovement.x+PARTY_MEMBER_OBJ[0]->spr->width*0.5*(PARTY_MEMBER_OBJ[0]->GetScale().x-1),
PARTY_MEMBER_OBJ[0]->GetPos().y-newMovement.y+(PARTY_MEMBER_OBJ[0]->spr->spr->sprite->height-4)*(PARTY_MEMBER_OBJ[0]->GetScale().y-1)};
for (int i=1;i<PARTY_MEMBER_COUNT;i++) {
PARTY_MEMBER_OBJ[i]->SetPos(partyTrail[PARTY_TRAIL_LENGTH*((double)i/4)]);
}
@ -2719,7 +2720,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
for (int i=0;i<PARTY_MEMBER_COUNT;i++) {
if (!MoveObjectTowardsPoint(PARTY_MEMBER_OBJ[i],
{BATTLE_ENCOUNTER->playerPos[i].x+BATTLE_ENCOUNTER->pos.x-PARTY_MEMBER_OBJ[i]->spr->width*0.5*(PARTY_MEMBER_OBJ[i]->GetScale().x-1),
BATTLE_ENCOUNTER->playerPos[i].y+BATTLE_ENCOUNTER->pos.y-PARTY_MEMBER_OBJ[i]->spr->spr->sprite->height*1*(PARTY_MEMBER_OBJ[i]->GetScale().y-1)},
BATTLE_ENCOUNTER->playerPos[i].y+BATTLE_ENCOUNTER->pos.y-(PARTY_MEMBER_OBJ[i]->spr->spr->sprite->height-4)*1*(PARTY_MEMBER_OBJ[i]->GetScale().y-1)},
PriorityDirection::BOTH,BATTLE_CAMERA_MOVESPD)) {
allDone=false;
}

Loading…
Cancel
Save