apply tile effec ton capture
This commit is contained in:
parent
d3eeca5489
commit
da29b64e49
2 changed files with 9 additions and 4 deletions
|
|
@ -157,15 +157,16 @@ func clearSelection() :
|
|||
|
||||
|
||||
|
||||
func updatePointsAndCapture(capturedPiece: Pawn) -> void:
|
||||
func updatePointsAndCapture(capturedPiece: Pawn, animate: bool = true) -> void:
|
||||
if Turn == 0:
|
||||
p1Points += capturedPiece.Points
|
||||
p1String.text = str(p1Points)
|
||||
else:
|
||||
p2Points += capturedPiece.Points
|
||||
p2String.text = str(p2Points)
|
||||
|
||||
animatePieceCapture(capturedPiece)
|
||||
|
||||
if animate:
|
||||
animatePieceCapture(capturedPiece)
|
||||
|
||||
|
||||
if capturedPiece.name == "King":
|
||||
|
|
|
|||
|
|
@ -221,8 +221,12 @@ func handleCapture(node: PieceContainer) -> void:
|
|||
var captured_piece = node.get_piece()
|
||||
|
||||
if moving_piece && captured_piece:
|
||||
game.updatePointsAndCapture(captured_piece)
|
||||
await game.animatePieceCapture(captured_piece)
|
||||
game.updatePointsAndCapture(captured_piece, false)
|
||||
node.animate_movement(source_container, moving_piece);
|
||||
var tile = game.tileManager.get_tile(node.name)
|
||||
if tile:
|
||||
tile.apply_effect(moving_piece)
|
||||
|
||||
|
||||
game.currentlyMovingPiece = moving_piece
|
||||
|
|
|
|||
Loading…
Reference in a new issue