Changeset 38 for trunk/UGame.pas
- Timestamp:
- Oct 13, 2019, 5:34:57 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r37 r38 111 111 function FillRandomTile(Value4Change: Double = 0.1): TTile; 112 112 function GetMoveArea(Direction: TMoveDirection): TArea; 113 procedure MoveAllAnimate(Direction: TMoveDirection); 113 114 public 114 115 Board: TBoard; … … 126 127 procedure New; 127 128 procedure Render(Canvas: TCanvas; CanvasSize: TPoint); 128 procedure MoveAll(Direction: TMoveDirection); 129 procedure MoveAllAnimate(Direction: TMoveDirection); 130 procedure MoveAllAndUpdate(Direction: TMoveDirection); 129 procedure MoveAll(Direction: TMoveDirection; Animation: Boolean); 130 procedure MoveAllAndUpdate(Direction: TMoveDirection; Animation: Boolean); 131 131 procedure MoveTile(SourceTile, TargetTile: TTile); 132 132 function IsValidPos(Pos: TPoint): Boolean; … … 226 226 for I := 0 to Step - 1 do 227 227 with Moves[I] do begin 228 GameStep.MoveAll(Direction );228 GameStep.MoveAll(Direction, False); 229 229 if GameStep.Board.Tiles[NewItemPos.Y, NewItemPos.X].Value = 0 then 230 230 GameStep.Board.Tiles[NewItemPos.Y, NewItemPos.X].Value := NewItemValue … … 608 608 end; 609 609 610 procedure TGame.MoveAll(Direction: TMoveDirection );610 procedure TGame.MoveAll(Direction: TMoveDirection; Animation: Boolean); 611 611 var 612 612 P: TPoint; … … 615 615 Area: TArea; 616 616 begin 617 if Animation then begin 618 MoveAllAnimate(Direction); 619 Exit; 620 end; 617 621 if Direction = drNone then Exit; 618 622 if not CanMoveDirection(Direction) then Exit; … … 856 860 end; 857 861 858 procedure TGame.MoveAllAndUpdate(Direction: TMoveDirection );862 procedure TGame.MoveAllAndUpdate(Direction: TMoveDirection; Animation: Boolean); 859 863 var 860 864 HighestValue: Integer; … … 864 868 if CanMoveDirection(Direction) then begin 865 869 HighestValue := Board.GetHighestTileValue; 866 MoveAll Animate(Direction);870 MoveAll(Direction, Animation); 867 871 868 872 NewTile := FillRandomTile;
Note:
See TracChangeset
for help on using the changeset viewer.