| 
	
  var   MyForm:TclGameForm;   ImgBall, ImgHole1,ImgHole2:TclProImage;   DeviceMotionSensor:TClMotionSensor;   LblDisplay:TclLabel;   GameTimer,Timer,Timer1,Timer2:TClTimer;   BtnStartGame:TclButton;   SoundIndex:Integer;myDeviceManager:TclDeviceManager;Kus_X,Kus_Y: Single;a,b,b1:Boolean;intersect_x1, intersect_y1, intersect_x2, intersect_y2,intersect_area: Integer; intersect_x1_2,intersect_y1_2,intersect_x2_2,intersect_y2_2,intersect_area1:Integer;  Function Max(in1,in2: Integer): Integer;   Begin   if in1 >= in2 then     Result:= in1;   else     Result:= in2;    End; Function Min(in1,in2: Integer): Integer;   Begin   if in1 <= in2 then     Result:= in1   else     Result:= in2;   End;  Procedure ProcOnGameTimer1; begin   if a then     MyForm.SetFormBGImage('rkw3wez.jpg')   else     MyForm.SetFormBGImage('234mi5f.jpg');   a:= not a; End;   function isBallinTheHole2: Boolean;   begin     Result := False;     if (ImgBall.Left+ImgBall.Width >= ImgHole2.Left) and (ImgBall.Top <= ImgHole2.Top+ImgHole2.Height) and   (ImgBall.Top+ImgBall.Height >= ImgHole2.Top) and   (ImgBall.Left <= ImgHole2.Left+ImgHole2.Width)  then      Result := True;   end;   function isBallinTheHole3: Boolean;     begin     Result:=False;     if (ImgBall.Left+ImgBall.Width >= ImgHole1.Left) and (ImgBall.Top <= ImgHole1.Top+ImgHole1.Height) and   (ImgBall.Top+ImgBall.Height >= ImgHole1.Top) and   (ImgBall.Left <= ImgHole1.Left+ImgHole1.Width)  then        Result:=True;   end;   Procedure ProcOnGameTimer3;   Const      BallSpeed = 8;   begin     ImgHole2.Align := alNone;     If Clomosy.PlatformIsMobile Then    Begin         ImgHole2.Position.X := ImgHole2.Position.X - BallSpeed;//Move left      end;       if (ImgHole2.Position.X + ImgHole2.Width) > TForm(MyForm).ClientWidth then  // Form Right border control         ImgHole2.Position.X := TForm(MyForm).ClientWidth - ImgHole2.Width;       if (ImgHole2.Position.Y + ImgHole2.Height) > TForm(MyForm).ClientHeight then  // Form Bottom border control         ImgHole2.Position.Y := TForm(MyForm).ClientHeight - ImgHole1.Height;       if (ImgHole2.Position.Y < 0) then  // Top border control         ImgHole2.Position.Y := 0;   end;   Procedure ProcOnGameTimer2;   Const      BallSpeed = 8;   begin     ImgHole1.Align := alNone;     If Clomosy.PlatformIsMobile Then    Begin         ImgHole1.Position.X := ImgHole1.Position.X - BallSpeed;//Move left      end;       if (ImgHole1.Position.X + ImgHole1.Width) > TForm(MyForm).ClientWidth then  // Form Right border control         ImgHole1.Position.X := TForm(MyForm).ClientWidth - ImgHole1.Width;       if (ImgHole1.Position.Y + ImgHole1.Height) > TForm(MyForm).ClientHeight then  // Form Bottom border control         ImgHole1.Position.Y := TForm(MyForm).ClientHeight - ImgHole1.Height;       if (ImgHole1.Position.Y < 0) then  // Top border control         ImgHole1.Position.Y := 0;   end;   Procedure ProcOnGameTimer;   Const      BallSpeed = 8;   begin     If Clomosy.PlatformIsMobile Then    Begin       Case DeviceMotionSensor.GetDirectionX of          1:ImgBall.Position.X := ImgBall.Position.X - BallSpeed;//Move left         2:ImgBall.Position.X := ImgBall.Position.X + BallSpeed;//Move right       End;       Case DeviceMotionSensor.GetDirectionY of          1:ImgBall.Position.Y := ImgBall.Position.Y - BallSpeed;//Move up         2:ImgBall.Position.Y := ImgBall.Position.Y + BallSpeed;//Move down       End;       if (ImgBall.Position.X + ImgBall.Width) > TForm(MyForm).ClientWidth then  // Form Right border control         ImgBall.Position.X := TForm(MyForm).ClientWidth - ImgBall.Width;       if (ImgBall.Position.X) < 0 then // Left border control         ImgBall.Position.X := 0;       if (ImgBall.Position.Y + ImgBall.Height) > TForm(MyForm).ClientHeight-150 then  // Form Bottom border control         ImgBall.Position.Y := TForm(MyForm).ClientHeight-150 - ImgBall.Height;       if (ImgBall.Position.Y < 0) then  // Top border control         ImgBall.Position.Y := 0;       else if b1 or isBallinTheHole2 then       begin         GameTimer.Enabled := False;         Timer.Enabled := False;         Timer1.Enabled:=False;         Timer2.Enabled:=False;         ImgBall.Position.X := Kus_X;         ImgBall.Position.Y := Kus_Y;         If Clomosy.PlatformIsMobile Then DeviceMotionSensor.Active := False;//game stopped         BtnStartGame.Text := 'START GAME';          ImgHole2.Position.x:=250;          ImgHole2.Position.y:=1;          ImgHole2.Margins.Top:=1;          ImgHole2.Margins.Bottom:=500;          ImgHole2.Margins.Left:=440;          ImgHole2.Margins.Right:=60;         MyForm.PlayGameSound(SoundIndex); //sound effect         myDeviceManager.Vibrate(1000); // vibration feature          ShowMessage('Mission Failed');       end;       else if b or isBallinTheHole3 then       begin         GameTimer.Enabled := False;         Timer.Enabled := False;         Timer1.Enabled:=False;         Timer2.Enabled:=False;         ImgBall.Position.X := Kus_X;         ImgBall.Position.Y := Kus_Y;         If Clomosy.PlatformIsMobile Then DeviceMotionSensor.Active := False;//game stopped         BtnStartGame.Text := 'START GAME';          ImgHole1.Position.x:=250;          ImgHole1.Position.y:=270;          ImgHole1.Margins.Top:=270;          ImgHole1.Margins.Bottom:=10;          ImgHole1.Margins.Left:=30;          ImgHole1.Margins.Right:=40;         MyForm.PlayGameSound(SoundIndex); //sound effect         myDeviceManager.Vibrate(1000); // vibration feature          ShowMessage('Mission Failed');       end;     End;   End;  Procedure BtnStartGameClick;  begin    GameTimer.Enabled := Not GameTimer.Enabled;    Timer.Enabled := Not Timer.Enabled;    Timer1.Enabled:= Not Timer1.Enabled;    Timer2.Enabled:=Not Timer2.Enabled;    If (GameTimer.Enabled) and (Timer.Enabled) and (Timer1.Enabled) and (Timer2.Enabled) Then BtnStartGame.Text := 'STOP GAME' ELSE BtnStartGame.Text := 'START GAME';    If (GameTimer.Enabled) and (Timer.Enabled) and (Timer1.Enabled) and (Timer2.Enabled) Then    Begin      ImgBall.Align := alNone;      ImgBall.Position.x := 0;      ImgBall.Position.y := 0;      If Clomosy.PlatformIsMobile Then DeviceMotionSensor.Active := True;    End Else If Clomosy.PlatformIsMobile Then DeviceMotionSensor.Active := False;//game stopped  End;  Begin  a:= False;  MyForm := TclGameForm.Create(Self);  myDeviceManager := TclDeviceManager.Create;  MyForm.SetFormBGImage('https://i.hizliresim.com/rkw3wez.jpg');  MyForm.AddGameAssetFromUrl('https://www.clomosy.com/game/assets/win.wav');  SoundIndex := MyForm.RegisterSound('win.wav');  MyForm.SoundIsActive:=True;  LblDisplay:= MyForm.AddNewLabel(MyForm,'LblDisplay','--');  LblDisplay.Align := alTop;  LblDisplay.Visible := False;  BtnStartGame:= MyForm.AddNewButton(MyForm,'BtnStartGame','START GAME');  BtnStartGame.Align := alBottom;  BtnStartGame.Height:=30;  BtnStartGame.StyledSettings := ssFamily;  BtnStartGame.TextSettings.FontColor := clAlphaColor.clHexToColor('#FFFFFF');  MyForm.AddNewEvent(BtnStartGame,tbeOnClick,'BtnStartGameClick');  ImgHole1 := MyForm.AddNewProImage(MyForm,'ImgHole1');  ImgHole1.clSetImage('https://i.hizliresim.com/cslph5r.png');  ImgHole1.Margins.Top:=270;  ImgHole1.Margins.Bottom:=10;  ImgHole1.Margins.Left:=30;  ImgHole1.Margins.Right:=40;  ImgHole1.Height:=25;  ImgHole1.Width:=75;  ImgHole1.Properties.AutoSize := False;  ImgHole1.Align := alRight;  ImgHole2 := MyForm.AddNewProImage(MyForm,'ImgHole2');  ImgHole2.clSetImage('https://i.hizliresim.com/7heqvui.png');  ImgHole2.Margins.Top:=1;  ImgHole2.Margins.Bottom:=500;  ImgHole2.Margins.Left:=440;  ImgHole2.Margins.Right:=60;  ImgHole2.Height:=25;  ImgHole2.Width:=75;  ImgHole2.Properties.AutoSize := False;  ImgHole2.Align := alRight;  ImgBall := MyForm.AddNewProImage(MyForm,'ImgBall');  ImgBall.clSetImage('https://i.hizliresim.com/eiro064.png');  ImgBall.Width := 60;  ImgBall.Height := 60;  ImgBall.Align := alCenter;  Kus_X:=ImgBall.Position.X+(ImgBall.Width);  Kus_Y:=ImgBall.Position.Y+(ImgBall.Height);  intersect_x1:= Max(ImgBall.Left, ImgHole1.Left);  intersect_y1:= Max(ImgBall.Top, ImgHole1.Top);  intersect_x2:= Min(ImgBall.Left+ImgBall.Width, ImgHole1.Left+ImgHole1.Width);  intersect_y2:= Min(ImgBall.Top+ImgBall.Height, ImgHole1.Top+ImgHole1.Height);  intersect_area:= (intersect_x2 - intersect_x1) * (intersect_y2 - intersect_y1);  b:= (intersect_area > 0) and (ImgBall.Top < ImgHole1.Top+ImgHole1.Height);    intersect_x1_2:= Max(ImgBall.Left, ImgHole2.Left);  intersect_y1_2:= Max(ImgBall.Top, ImgHole2.Top);  intersect_x2_2:= Min(ImgBall.Left+ImgBall.Width, ImgHole2.Left+ImgHole2.Width);  intersect_y2_2:= Min(ImgBall.Top+ImgBall.Height, ImgHole2.Top+ImgHole2.Height);  intersect_area1:= (intersect_x2_2 - intersect_x1_2) * (intersect_y2_2 - intersect_y1_2);  b1:= (intersect_area1 > 0) and (ImgBall.Top < ImgHole2.Top+ImgHole2.Height);    ImgBall.Align := alNone;  ImgBall.Position.Y := Kus_Y;  DeviceMotionSensor := MyForm.AddNewSensorsMotion(MyForm,'DeviceMotionSensor');  DeviceMotionSensor.Active := Clomosy.PlatformIsMobile;  MyForm.AddGameAssetFromUrl('https://i.hizliresim.com/rkw3wez.jpg');  MyForm.AddGameAssetFromUrl('https://i.hizliresim.com/234mi5f.jpg');  GameTimer:= MyForm.AddNewTimer(MyForm,'GameTimer',1000);  GameTimer.Interval := 30;  GameTimer.Enabled :=False;  MyForm.AddNewEvent(GameTimer,tbeOnTimer,'ProcOnGameTimer');  Timer:= MyForm.AddNewTimer(MyForm,'timer',300);  Timer.Enabled:= False;  MyForm.AddNewEvent(Timer,tbeOnTimer,'ProcOnGameTimer1');  Timer1:= MyForm.AddNewTimer(MyForm,'timer1',300);  Timer1.Enabled:= False;  MyForm.AddNewEvent(Timer1,tbeOnTimer,'ProcOnGameTimer2');  Timer2:= MyForm.AddNewTimer(MyForm,'timer2',300);  Timer2.Enabled:= False;  MyForm.AddNewEvent(Timer2,tbeOnTimer,'ProcOnGameTimer3');  MyForm.Run; End; 
 
 Tüm proje kodum.. 
          |