generated from sigonasr2/CPlusPlusProjectTemplate
Move actions completed
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
2e1815fd44
commit
f76dd92cab
Binary file not shown.
BIN
assets/arrow_connector.png
Normal file
BIN
assets/arrow_connector.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 742 B |
48
main.cpp
48
main.cpp
@ -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;
|
}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;
|
cursorOffset+=SELECTED_MOVE_SQUARE*32;
|
||||||
DrawDecal((vi2d)((PARTY_MEMBER_OBJ[-CURRENT_TURN-1]->GetPosWithOrigin()-cameraPos)/32)*32+cursorOffset,SPRITES["crosshair.png"],cursorScale);
|
DrawDecal((vi2d)((PARTY_MEMBER_OBJ[-CURRENT_TURN-1]->GetPosWithOrigin()-cameraPos)/32)*32+cursorOffset,SPRITES["crosshair.png"],cursorScale);
|
||||||
|
DrawArrow();
|
||||||
}
|
}
|
||||||
for (auto numb:DAMAGE_NUMBERS) {
|
for (auto numb:DAMAGE_NUMBERS) {
|
||||||
vd2d shadowOffset={1,1};
|
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("targetCircle.png");
|
||||||
CreateSprite("targetRange.png");
|
CreateSprite("targetRange.png");
|
||||||
CreateSprite("crosshair.png");
|
CreateSprite("crosshair.png");
|
||||||
|
CreateSprite("arrow_connector.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupObjectInfo() {
|
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);
|
Pixel collisionData = GAME->GetDrawTarget()->GetPixel((int)pos.x,(int)pos.y);
|
||||||
return collisionData!=MAGENTA;
|
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…
x
Reference in New Issue
Block a user