Changeset 68
- Timestamp:
- Jan 26, 2020, 10:57:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormComputer.pas
r50 r68 161 161 J: Integer; 162 162 GameTries: TGameTries; 163 Delay: Integer; 163 164 begin 164 165 ButtonStart.Enabled := False; … … 201 202 else Break; 202 203 } 203 Application.ProcessMessages; 204 Sleep(TrackBar1.Position); 204 Delay := TrackBar1.Position; 205 while Delay > 0 do begin 206 Application.ProcessMessages; 207 Sleep(10); 208 Delay := Delay - 10; 209 end; 205 210 end; 206 211 end; -
trunk/Forms/UFormMain.pas
r67 r68 223 223 while Length(MoveBuffer) > 0 do begin 224 224 MoveBufferLock.Release; 225 Core.Game.MoveAllAndUpdate(MoveBuffer[0], True);225 Core.Game.MoveAllAndUpdate(MoveBuffer[0], Core.Game.AnimationDuration > 0); 226 226 MoveBufferLock.Acquire; 227 227 if Length(MoveBuffer) > 1 then -
trunk/UGame.pas
r65 r68 733 733 I: Integer; 734 734 Area: TArea; 735 DstTile: TTile; 736 SrcTile: TTile; 737 TileMoved: Boolean; 735 738 begin 736 739 if Animation then begin … … 746 749 Board.ClearMerged; 747 750 for I := 0 to Max(Board.Size.X, Board.Size.Y) - 1 do begin 751 TileMoved := False; 748 752 P := Area.P1; 749 753 while P.Y <> Area.P2.Y + Area.Increment.Y do begin … … 752 756 PNew := P + DirectionDiff[Direction]; 753 757 if IsValidPos(PNew) then begin 754 if (Board.Tiles[P.Y, P.X].Value <> 0) then begin 755 if (Board.Tiles[PNew.Y, PNew.X].Value = 0) then begin 756 Board.Tiles[PNew.Y, PNew.X].Value := Board.Tiles[P.Y, P.X].Value; 757 Board.Tiles[PNew.Y, PNew.X].Merged := Board.Tiles[P.Y, P.X].Merged; 758 Board.Tiles[P.Y, P.X].Value := 0; 759 Board.Tiles[P.Y, P.X].Merged := False; 758 SrcTile := Board.Tiles[P.Y, P.X]; 759 DstTile := Board.Tiles[PNew.Y, PNew.X]; 760 if SrcTile.Value <> 0 then begin 761 if DstTile.Value = 0 then begin 762 DstTile.Value := SrcTile.Value; 763 DstTile.Merged := SrcTile.Merged; 764 SrcTile.Value := 0; 765 SrcTile.Merged := False; 766 TileMoved := True; 760 767 end else 761 if (not Board.Tiles[P.Y, P.X].Merged) and (not Board.Tiles[PNew.Y, PNew.X].Merged) and 762 CanMergeTile(Board.Tiles[PNew.Y, PNew.X].Value, Board.Tiles[P.Y, P.X].Value) then begin 763 Board.Tiles[PNew.Y, PNew.X].Value := MergeTile(Board.Tiles[PNew.Y, PNew.X].Value, Board.Tiles[P.Y, P.X].Value); 764 Board.Tiles[PNew.Y, PNew.X].Merged := True; 765 Board.Tiles[P.Y, P.X].Value := 0; 766 Board.Tiles[P.Y, P.X].Merged := False; 767 Score := Score + GetTileSkinScore(Board.Tiles[PNew.Y, PNew.X].Value); 768 if (not SrcTile.Merged) and (not DstTile.Merged) and 769 CanMergeTile(DstTile.Value, SrcTile.Value) then begin 770 DstTile.Value := MergeTile(DstTile.Value, SrcTile.Value); 771 DstTile.Merged := True; 772 SrcTile.Value := 0; 773 SrcTile.Merged := False; 774 Score := Score + GetTileSkinScore(SrcTile.Value); 775 TileMoved := True; 768 776 end; 769 777 end; … … 773 781 Inc(P.Y, Area.Increment.Y); 774 782 end; 775 DoPaint; 776 end; 783 if not TileMoved then Break; 784 end; 785 DoPaint; 777 786 FMoving := False; 778 787 end; … … 811 820 if RecordHistory then History.Moves.Delete(History.Moves.Count - 1); 812 821 DoChange; 822 DoPaint; 813 823 end; 814 824 end; … … 1080 1090 HistoryMove: THistoryMove; 1081 1091 NewTile: TTile; 1092 X, Y: Integer; 1082 1093 begin 1083 1094 if CanMoveDirection(Direction) then begin … … 1086 1097 1087 1098 NewTile := FillRandomTile; 1088 if Animation then AnimateTiles; 1099 if Animation then AnimateTiles else begin 1100 for Y := 0 to Board.Size.Y - 1 do 1101 for X := 0 to Board.Size.X - 1 do 1102 if Board.Tiles[Y, X].Action <> taNone then begin 1103 Board.Tiles[Y, X].Action := taNone; 1104 Board.Tiles[Y, X].Shift := Point(0, 0); 1105 end; 1106 DoPaint; 1107 end; 1089 1108 1090 1109 if RecordHistory then begin … … 1100 1119 if (HighestValue < WinTileValue) and 1101 1120 (Board.GetHighestTileValue >= WinTileValue) then Win; 1121 DoChange; 1102 1122 end; 1103 1123 end;
Note:
See TracChangeset
for help on using the changeset viewer.