Changeset 56 for trunk/UGame.pas
- Timestamp:
- Nov 5, 2019, 1:27:20 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r55 r56 633 633 Frame.Top + Frame.Height div 2 + (Board.Size.Y * TileSize.Y) div 2); 634 634 635 TileMargin := Round(Frame.Width / Board.Size.X * 0.0 25);635 TileMargin := Round(Frame.Width / Board.Size.X * 0.03); 636 636 637 637 Canvas.Brush.Style := bsSolid; … … 673 673 end; 674 674 675 // Draw moving tiles675 // Draw appearing tiles 676 676 for Y := 0 to Board.Size.Y - 1 do 677 677 for X := 0 to Board.Size.X - 1 do … … 691 691 TileRect := Rect(TileCenter.X - S.X div 2, TileCenter.Y - S.Y div 2, 692 692 TileCenter.X + S.X div 2, TileCenter.Y + S.Y div 2); 693 RenderTile(Canvas, Board.Tiles[Y, X], TileRect, True); 694 end; 695 696 // Draw merging tiles 697 for Y := 0 to Board.Size.Y - 1 do 698 for X := 0 to Board.Size.X - 1 do 699 if Board.Tiles[Y, X].Action = taMerge then begin 700 Canvas.Brush.Color := GetTileColor(Board.Tiles[Y, X].Value); 701 Canvas.Brush.Style := bsSolid; 702 TileRect := Bounds( 703 Frame.Left + X * TileSize.X + TileMargin, 704 Frame.Top + Y * TileSize.Y + TileMargin, 705 TileSize.X - 2 * TileMargin, 706 TileSize.Y - 2 * TileMargin); 707 S := Point( 708 Trunc((50 - Abs(Board.Tiles[Y, X].Shift.X - 50)) / 50 * TileMargin), 709 Trunc((50 - Abs(Board.Tiles[Y, X].Shift.Y - 50)) / 50 * TileMargin) 710 ); 711 TileRect := Rect(TileRect.Left - S.X, TileRect.Top - S.Y, 712 TileRect.Right + S.X, TileRect.Bottom + S.Y); 693 713 RenderTile(Canvas, Board.Tiles[Y, X], TileRect, True); 694 714 end; … … 777 797 FCanUndo := False; 778 798 FRunning := CanMove; 779 History.Moves.Delete(History.Moves.Count - 1);799 if RecordHistory then History.Moves.Delete(History.Moves.Count - 1); 780 800 DoChange; 781 801 end; … … 938 958 for Y := 0 to Board.Size.Y - 1 do 939 959 for X := 0 to Board.Size.X - 1 do begin 960 if Board.Tiles[Y, X].Merged then 961 Board.Tiles[Y, X].Action := taMerge; 940 962 Board.Tiles[Y, X].Shift := Point(0, 0); 941 Board.Tiles[Y, X].Action := taNone; 963 if Board.Tiles[Y, X].Action = taMove then begin 964 Board.Tiles[Y, X].Action := taNone; 965 end; 942 966 Board.Tiles[Y, X].Value := Board.Tiles[Y, X].NewValue; 943 967 end; … … 959 983 procedure TGame.AnimateTiles; 960 984 var 961 I: Integer;962 985 StartTime: TDateTime; 963 986 EndTime: TDateTime; … … 980 1003 if Board.Tiles[Y, X].Action = taAppear then 981 1004 Board.Tiles[Y, X].Shift := Point(Trunc(Part * 100), Trunc(Part * 100)); 1005 if Board.Tiles[Y, X].Action = taMerge then 1006 Board.Tiles[Y, X].Shift := Point(Trunc(Part * 100), Trunc(Part * 100)); 982 1007 end; 983 1008 DoChange; … … 988 1013 for Y := 0 to Board.Size.Y - 1 do 989 1014 for X := 0 to Board.Size.X - 1 do 990 if Board.Tiles[Y, X].Action = taAppearthen begin1015 if Board.Tiles[Y, X].Action <> taNone then begin 991 1016 Board.Tiles[Y, X].Action := taNone; 992 1017 Board.Tiles[Y, X].Shift := Point(0, 0);
Note:
See TracChangeset
for help on using the changeset viewer.