Changeset 20 for trunk/Forms/UFormMain.pas
- Timestamp:
- Oct 5, 2019, 2:00:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r19 r20 16 16 MainMenu1: TMainMenu; 17 17 MenuItem1: TMenuItem; 18 MenuItem2: TMenuItem; 18 19 MenuItemNew: TMenuItem; 19 20 MenuItemExit: TMenuItem; … … 48 49 49 50 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 50 var51 MovedCount: Integer;52 51 begin 53 52 if Core.Game.Running and not Core.Game.Moving then begin 54 MovedCount := 0;55 53 case Key of 56 37: MovedCount :=Core.Game.MoveAll(drLeft);57 38: MovedCount :=Core.Game.MoveAll(drUp);58 39: MovedCount :=Core.Game.MoveAll(drRight);59 40: MovedCount :=Core.Game.MoveAll(drDown);54 37: Core.Game.MoveAll(drLeft); 55 38: Core.Game.MoveAll(drUp); 56 39: Core.Game.MoveAll(drRight); 57 40: Core.Game.MoveAll(drDown); 60 58 end; 61 if MovedCount > 0 then Core.Game.FillRandomTile;62 if not Core.Game.CanMove and (Core.Game.Board.GetEmptyTilesCount = 0) then63 Core.Game.GameOver;64 if (not Core.Game.Won) and (Core.Game.Board.GetHighestTileValue >= 2048) then65 Core.Game.Win;66 59 end; 67 60 end;
Note:
See TracChangeset
for help on using the changeset viewer.