procedure TViewFormMain.MyShapeMouseDownEvent(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); function ChangeColor(ACondition: Boolean; AColorTrue, AColorFalse: TColor): TColor; begin result := AColorFalse; // if ACondition then result := AColorTrue; end;
var AShape: TShape; begin if not(Sender is TShape) then exit; // AShape := TShape(Sender); // if (AShape.Brush.Color = clWhite) then begin inc(LastClickToGameOver); // if (LastClickToGameOver = 1) then begin ClrBxPlayerOne.Enabled := false; ClrBxPlayerTwo.Enabled := false; end; // LastShapePlayed := AShape; // AShape.Brush.Color := ChangeColor(AShape.Tag = 0, ClrBxPlayerOne.Selected, ClrBxPlayerTwo.Selected); // AShape.Tag := 1 xor AShape.Tag; // DoesAnybodyWon(AShape); // ChangingSettingOtherShapes(AShape.Tag); end else begin if not(LastShapePlayed = nil) and (AShape = LastShapePlayed) and (AShape.Brush.Color = LastShapePlayed.Brush.Color) then begin dec(LastClickToGameOver); // AShape.Tag := 1 xor AShape.Tag; AShape.Brush.Color := clWhite; // LastShapePlayed := nil; // ChangingSettingOtherShapes(AShape.Tag); end; end; end;
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3