Changeset 33
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormSettings.lfm
r19 r33 25 25 Top = 16 26 26 Width = 240 27 Max = 100 27 Max = 1000 28 28 Position = 0 29 29 Anchors = [akTop, akLeft, akRight] -
trunk/UCore.pas
r31 r33 80 80 Game.OnChange := GameChange; 81 81 Game.OnWin := GameWin; 82 Game.OnGameOver := GameOver; 82 83 LoadConfig; 83 84 end; -
trunk/UGame.pas
r32 r33 103 103 procedure SetScore(AValue: Integer); 104 104 procedure DoChange; 105 procedure RenderTile(Canvas: TCanvas; Tile: TTile; TileRect: TRect );105 procedure RenderTile(Canvas: TCanvas; Tile: TTile; TileRect: TRect; WithText: Boolean); 106 106 procedure GameOver; 107 107 procedure Win; … … 608 608 Frame.Top + Y * TileSize.Y + TileMargin, 609 609 TileSize.X - 2 * TileMargin, TileSize.Y - 2 * TileMargin); 610 RenderTile(Canvas, Board.Tiles[Y, X], TileRect );610 RenderTile(Canvas, Board.Tiles[Y, X], TileRect, not Board.Tiles[Y, X].Moving); 611 611 end; 612 612 … … 621 621 Frame.Top + Y * TileSize.Y + Trunc(Board.Tiles[Y, X].Shift.Y / 100 * TileSize.Y + TileMargin), 622 622 TileSize.X - 2 * TileMargin, TileSize.Y - 2 * TileMargin); 623 RenderTile(Canvas, Board.Tiles[Y, X], TileRect );623 RenderTile(Canvas, Board.Tiles[Y, X], TileRect, True); 624 624 end; 625 625 end; … … 674 674 end; 675 675 676 procedure TGame.RenderTile(Canvas: TCanvas; Tile: TTile; TileRect: TRect );676 procedure TGame.RenderTile(Canvas: TCanvas; Tile: TTile; TileRect: TRect; WithText: Boolean); 677 677 var 678 678 ValueStr: string; … … 680 680 begin 681 681 Canvas.FillRect(TileRect); 682 if Tile.Value <> 0then begin682 if WithText and (Tile.Value <> 0) then begin 683 683 ValueStr := IntToStr(Tile.Value); 684 684 Canvas.Brush.Style := bsClear; … … 704 704 FCanUndo := False; 705 705 FRunning := CanMove; 706 History.Moves.Delete(History.Moves.Count - 1); 706 707 DoChange; 707 708 end; … … 784 785 Part: Double; 785 786 Area: TArea; 787 TileMoved: Boolean; 786 788 begin 787 789 if Direction = drNone then Exit; … … 799 801 end; 800 802 803 TileMoved := False; 801 804 P := Area.P1; 802 805 while P.Y <> Area.P2.Y + Area.Increment.Y do begin … … 812 815 Board.Tiles[P.Y, P.X].NewValue := 0; 813 816 Board.Tiles[P.Y, P.X].Merged := False; 817 TileMoved := True; 814 818 end else 815 819 if (not Board.Tiles[P.Y, P.X].Merged) and (not Board.Tiles[PNew.Y, PNew.X].Merged) and … … 821 825 Board.Tiles[P.Y, P.X].Merged := False; 822 826 Score := Score + Board.Tiles[PNew.Y, PNew.X].NewValue; 827 TileMoved := True; 823 828 end; 824 829 end; … … 828 833 Inc(P.Y, Area.Increment.Y); 829 834 end; 835 if not TileMoved then Break; 830 836 831 837 // Animate tiles move … … 851 857 for Y := 0 to Board.Size.Y - 1 do 852 858 for X := 0 to Board.Size.X - 1 do begin 853 Board.Tiles[Y, X].Shift := Point(0, 0);854 Board.Tiles[Y, X].Moving := False;855 859 Board.Tiles[Y, X].Value := Board.Tiles[Y, X].NewValue; 856 860 end; 857 DoChange; 858 end; 861 end; 862 863 // Set final tiles values 864 for Y := 0 to Board.Size.Y - 1 do 865 for X := 0 to Board.Size.X - 1 do begin 866 Board.Tiles[Y, X].Shift := Point(0, 0); 867 Board.Tiles[Y, X].Moving := False; 868 Board.Tiles[Y, X].Value := Board.Tiles[Y, X].NewValue; 869 end; 870 DoChange; 859 871 FMoving := False; 860 872 end;
Note:
See TracChangeset
for help on using the changeset viewer.