Move actions completed

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 2e1815fd44
commit f76dd92cab
  1. BIN
      C++ProjectTemplate
  2. BIN
      assets/arrow_connector.png
  3. 48
      main.cpp

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

@ -1229,6 +1229,11 @@ goes on a very long time, I hope you can understand this is only for testing pur
}
}
}
if (ACTIONKEYPRESSED) {
BATTLE_ENCOUNTER->playerPos[-CURRENT_TURN-1]=(BATTLE_ENCOUNTER->playerPos[-CURRENT_TURN-1]/32+SELECTED_MOVE_SQUARE)*32;
BATTLE_STATE=BattleState::MOVE_CAMERA;
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->atb=400;
}
}break;
}
}
@ -1703,6 +1708,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
}
cursorOffset+=SELECTED_MOVE_SQUARE*32;
DrawDecal((vi2d)((PARTY_MEMBER_OBJ[-CURRENT_TURN-1]->GetPosWithOrigin()-cameraPos)/32)*32+cursorOffset,SPRITES["crosshair.png"],cursorScale);
DrawArrow();
}
for (auto numb:DAMAGE_NUMBERS) {
vd2d shadowOffset={1,1};
@ -2150,6 +2156,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
CreateSprite("targetCircle.png");
CreateSprite("targetRange.png");
CreateSprite("crosshair.png");
CreateSprite("arrow_connector.png");
}
void SetupObjectInfo() {
@ -3449,6 +3456,47 @@ goes on a very long time, I hope you can understand this is only for testing pur
Pixel collisionData = GAME->GetDrawTarget()->GetPixel((int)pos.x,(int)pos.y);
return collisionData!=MAGENTA;
}
void DrawArrow() {
vi2d startingPos = {0,0};
vi2d drawingPos = {(vi2d)(PARTY_MEMBER_OBJ[-CURRENT_TURN-1]->GetPosWithOrigin()-cameraPos)/32};
vi2d center={16,16};
bool lastMoveWasX=false; //When set to true, the previous move was in the X axis. This is used for the elbow connector.
bool flippedX=(SELECTED_MOVE_SQUARE.x>startingPos.x);
bool flippedY=(SELECTED_MOVE_SQUARE.y<startingPos.y);
std::cout<<startingPos<<"//"<<SELECTED_MOVE_SQUARE<<"\n";
while (startingPos!=SELECTED_MOVE_SQUARE) {
if (startingPos.x!=SELECTED_MOVE_SQUARE.x) {
DrawPartialRotatedDecal((drawingPos+startingPos)*32+center,SPRITES["arrow_connector.png"],M_PI_2,{16,16},{0,0},{32,32});
startingPos.x+=SELECTED_MOVE_SQUARE.x>startingPos.x?1:-1;
lastMoveWasX=true;
continue;
}
if (startingPos.y!=SELECTED_MOVE_SQUARE.y) {
if (lastMoveWasX) {
//Elbow Connector
if (SELECTED_MOVE_SQUARE.y>startingPos.y) {
DrawPartialRotatedDecal((drawingPos+startingPos)*32+center,SPRITES["arrow_connector.png"],(flippedX)?M_PI:M_PI_2,{16,16},{32,0},{32,32});
} else {
DrawPartialRotatedDecal((drawingPos+startingPos)*32+center,SPRITES["arrow_connector.png"],(flippedX)?M_PI_2*3:0,{16,16},{32,0},{32,32});
}
lastMoveWasX=false;
} else {
//Straight Connector.
DrawPartialRotatedDecal((drawingPos+startingPos)*32+center,SPRITES["arrow_connector.png"],0,{16,16},{0,0},{32,32});
}
startingPos.y+=SELECTED_MOVE_SQUARE.y>startingPos.y?1:-1;
continue;
}
}
if (SELECTED_MOVE_SQUARE.x!=0||SELECTED_MOVE_SQUARE.y!=0) {
if (SELECTED_MOVE_SQUARE.y==0) {
DrawPartialRotatedDecal((SELECTED_MOVE_SQUARE+drawingPos)*32+center,SPRITES["arrow_connector.png"],(flippedX)?M_PI_2*3:M_PI_2,{16,16},{64,0},{32,32});
} else {
DrawPartialRotatedDecal((SELECTED_MOVE_SQUARE+drawingPos)*32+center,SPRITES["arrow_connector.png"],(flippedY)?M_PI:0,{16,16},{64,0},{32,32});
}
}
}
};

Loading…
Cancel
Save