Sayfayı Yazdır | Pencereyi Kapat

Oyunda ortadan geçtiğinde de oyunu bitirmesi

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=556
Tarih: 07 Ocak 2025 Saat 23:57
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: Oyunda ortadan geçtiğinde de oyunu bitirmesi
Mesajı Yazan: SefaBuyuksoylu
Konu: Oyunda ortadan geçtiğinde de oyunu bitirmesi
Mesaj Tarihi: 08 Ağustos 2023 Saat 10:23
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;
Uygulamam ortadan geçtiğinde de sanki engele çarpmış gibi mesaj verip oyunu bitiriyor,kod kısmını attım acaba yükseklikle alakalı bir sorun mu var?





Cevaplar:
Mesajı Yazan: Alforce
Mesaj Tarihi: 08 Ağustos 2023 Saat 10:54
Şuan bundan daha güzel çalışan bir karşılaştırma koduna sahibim.

Bunu deneyebilirsiniz.
Var
   intersect_x1, intersect_y1, intersect_x2, intersect_y2,
  intersect_area: Integer;
b: Boolean;
Begin
  intersect_x1:= max(testImg.Left, engelimg.Left);
  intersect_y1:= max(testImg.Top, engelimg.Top);
  intersect_x2:= min(testImg.Left+testImg.Width, engelimg.Left+engelimg.Width);
  intersect_y2:= min(testImg.Top+testImg.Height, engelimg.Top+engelimg.Height);
  intersect_area:= (intersect_x2 - intersect_x1) * (intersect_y2 - intersect_y1);
  
  b:= (intersect_area > 0) and (testImg.Top < engelimg.Top+engelimg.Height);  
  
  if b then
  Begin
    ShowMessage('Engele dokanıldı');
    engelimg.Top:= 1;
    engel1img.Top:= 1;
    engel2img.Top:= 1;
  End;


Mesajı Yazan: SefaBuyuksoylu
Mesaj Tarihi: 08 Ağustos 2023 Saat 11:21
Bu şekil hata alıyorum max tanımlı değil hatası ??


Mesajı Yazan: Alforce
Mesaj Tarihi: 08 Ağustos 2023 Saat 11:24
Tamam, sanırım bunlar eksik:
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;


Mesajı Yazan: SefaBuyuksoylu
Mesaj Tarihi: 08 Ağustos 2023 Saat 15:07
  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..


Mesajı Yazan: Alforce
Mesaj Tarihi: 08 Ağustos 2023 Saat 17:19
Bu nasıl:
Const 
  BallSpeed = 2;
Var
  MyForm: TclGameForm;
  ImgBall,ImgHole1,ImgHole2: TclProImage;
  DeviceMotionSensor: TClMotionSensor;
  LblDisplay: TclLabel;
  GameTimer,Timer,Timer1,Timer2: TClTimer;
  BtnStartGame: TclButton;
  SoundIndex:Integer;
  myDeviceManager: TclDeviceManager;
  a:Boolean;
  
  intersect_x1,intersect_y1,intersect_x2,intersect_y2,intersect_area: 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
  intersect_x1:= max(ImgBall.Left, ImgHole2.Left);
  intersect_y1:= max(ImgBall.Top, ImgHole2.Top);
  intersect_x2:= min(ImgBall.Left +ImgBall.Width, ImgHole2.Left +ImgHole2.Width);
  intersect_y2:= min(ImgBall.Top +ImgBall.Height, ImgHole2.Top +ImgHole2.Height);
  intersect_area:= (intersect_x2 -intersect_x1) *(intersect_y2 -intersect_y1);
  
  Result:= (intersect_area > 0) and (ImgBall.Left < ImgHole2.Left+ImgHole2.Width) and (ImgBall.Left+ImgBall.Width > ImgHole2.Left) and (ImgBall.Top+ImgBall.Height > ImgHole2.Top); 
End;
  
function isBallinTheHole3: Boolean;
begin
  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);
  
  Result:= (intersect_area > 0) and (ImgBall.Left < ImgHole1.Left+ImgHole1.Width) and (ImgBall.Left+ImgBall.Width > ImgHole1.Left) and (ImgBall.Top < ImgHole1.Top+ImgHole1.Height); 
end;

Procedure ProcOnGameTimer3;
Begin
  ImgHole2.Align:= alNone;
  If Clomosy.PlatformIsMobile Then
    ImgHole2.Position.X:= ImgHole2.Position.X -BallSpeed;//Move left
  
  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;
Begin
  ImgHole1.Align:= alNone;
  If Clomosy.PlatformIsMobile Then
      ImgHole1.Position.X:= ImgHole1.Position.X - BallSpeed;//Move left
  
  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;
begin
  If Clomosy.PlatformIsMobile Then
  Begin
    ImgBall.Position.X:= ImgBall.Position.X +BallSpeed;
    
    Case DeviceMotionSensor.GetDirectionY of 
      1: ImgBall.Position.Y:= ImgBall.Position.Y -(BallSpeed*4);//Move up
      2: ImgBall.Position.Y:= ImgBall.Position.Y +(BallSpeed*4);//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;
    
    if isBallinTheHole2 or isBallinTheHole3 then
    begin
      GameTimer.Enabled:= False;
      Timer.Enabled:= False;
      Timer1.Enabled:= False;
      Timer2.Enabled:= False;
      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;
  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 Then
    BtnStartGame.Text:= 'STOP GAME'
  Else
    BtnStartGame.Text:= 'START GAME';
  
  If GameTimer.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.AddGameAssetFromUrl('https://i.hizliresim.com/rkw3wez.jpg');
  MyForm.AddGameAssetFromUrl('https://i.hizliresim.com/234mi5f.jpg');
  MyForm.AddGameAssetFromUrl('https://i.hizliresim.com/cslph5r.png'); //ImgHole1
  MyForm.AddGameAssetFromUrl('https://i.hizliresim.com/7heqvui.png'); //ImgHole2
  MyForm.AddGameAssetFromUrl('https://i.hizliresim.com/eiro064.png'); //ImgBall
  MyForm.AddGameAssetFromUrl('https://www.clomosy.com/game/assets/win.wav');
  
  MyForm.SetFormBGImage('rkw3wez.jpg');
  
  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('cslph5r.png');
  ImgHole1.Align:= alNone;
  ImgHole1.Top:= TForm(MyForm).ClientHeight-300;
  ImgHole1.Height:= 300;
  ImgHole1.Width:= 75;
  
  ImgHole2:= MyForm.AddNewProImage(MyForm,'ImgHole2');
  ImgHole2.clSetImage('7heqvui.png');
  ImgHole2.Align:= alNone;
  ImgHole2.Top:= 0;
  ImgHole2.Height:= 300;
  ImgHole2.Width:= 75;
  
  ImgBall:= MyForm.AddNewProImage(MyForm,'ImgBall');
  ImgBall.clSetImage('eiro064.png');
  ImgBall.Align:= alNone;
  ImgBall.Width:= 30;
  ImgBall.Height:= 30;
  
  DeviceMotionSensor:= MyForm.AddNewSensorsMotion(MyForm,'DeviceMotionSensor');
  DeviceMotionSensor.Active:= Clomosy.PlatformIsMobile;
  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;



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net