Sayfayı Yazdır | Pencereyi Kapat

clIsIntersectsWith

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=891
Tarih: 07 Ocak 2025 Saat 23:25
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: clIsIntersectsWith
Mesajı Yazan: Habip
Konu: clIsIntersectsWith
Mesaj Tarihi: 19 Ağustos 2024 Saat 18:03
var
MyGameForm:tclgameform;
spearTimer:TCLTimer;
spearImage:TClProImage;
backGroundImage,groundImage:TClProImage;
void SpearMove
{
  if(spearImage.rotationAngle<270)
  {
    spearImage.rotationAngle=spearImage.rotationAngle+2;
    if(spearImage.rotationAngle<150)
    {
      backGroundImage.position.x=backGroundImage.position.x-4;
      backGroundImage.position.y=backGroundImage.position.y-4;
      groundImage.position.x=groundImage.position.x-20;
      groundImage.position.y=groundImage.position.y-20;
    }
    else if(spearImage.rotationAngle<165)
    {
      backGroundImage.position.x=backGroundImage.position.x-3;
      backGroundImage.position.y=backGroundImage.position.y-4;
      groundImage.position.x=groundImage.position.x-15;
      groundImage.position.y=groundImage.position.y-20;
    }
    else if(spearImage.rotationAngle<180)
    {
      backGroundImage.position.x=backGroundImage.position.x-2;
      backGroundImage.position.y=backGroundImage.position.y-4;
      groundImage.position.x=groundImage.position.x-10;
      groundImage.position.y=groundImage.position.y-20;
    }
    else if(spearImage.rotationAngle<195)
    {
      backGroundImage.position.y=backGroundImage.position.y-3;
      groundImage.position.y=groundImage.position.y-15;
    }
    else if(spearImage.rotationAngle<210)
    {
      backGroundImage.position.x=backGroundImage.position.x+3;
      backGroundImage.position.y=backGroundImage.position.y-3;
      groundImage.position.x=groundImage.position.x+15;
      groundImage.position.y=groundImage.position.y-15;
    }
    else if(spearImage.rotationAngle<225)
    {
      backGroundImage.position.x=backGroundImage.position.x+4;
      backGroundImage.position.y=backGroundImage.position.y-1.6;
      groundImage.position.x=groundImage.position.x+20;
      groundImage.position.y=groundImage.position.y-8;
    }
    else if(spearImage.rotationAngle<240)
    {
      backGroundImage.position.x=backGroundImage.position.x+4;
      backGroundImage.position.y=backGroundImage.position.y-1.2;
      groundImage.position.x=groundImage.position.x+20;
      groundImage.position.y=groundImage.position.y-6;
    }
    else if(spearImage.rotationAngle<255)
    {
      backGroundImage.position.x=backGroundImage.position.x+4;
      backGroundImage.position.y=backGroundImage.position.y-0.8;
      groundImage.position.x=groundImage.position.x+20;
      groundImage.position.y=groundImage.position.y-4;
    }
    else if(spearImage.rotationAngle<270)
    {
      backGroundImage.position.x=backGroundImage.position.x+4;
      backGroundImage.position.y=backGroundImage.position.y-0.4;
      groundImage.position.x=groundImage.position.x+20;
      groundImage.position.y=groundImage.position.y-2;
    }
    if(MyGameForm.clIsIntersectsWith(spearImage, groundImage))
    {
      spearTimer.enabled=false;
    }
    
  }
  else
  {
    spearTimer.enabled=false;
  }
}
{
  MyGameForm=tclgameform.Create(Self);
  
  spearImage = MyGameForm.AddNewProImage(MyGameForm,'spearImage');
  clComponent.SetupComponent(spearImage,'{
  "Align" : "alNone",
  "Width" :60,
  "Height":259,
  "ImgUrl":" https://i.imgur.com/bPXoifl.png" rel="nofollow - https://i.imgur.com/bPXoifl.png" ,
  "BackgroundColor":"#FFFFFF",
  "ImgFit":"yes"}');
  spearImage.rotationAngle=135;
  spearImage.position.x=MyGameForm.clWidth;
  
  groundImage = MyGameForm.AddNewProImage(MyGameForm,'groundImage');
  clComponent.SetupComponent(groundImage,'{
  "Align" : "alNone",
  "Width" :1921,
  "BackgroundColor":"#FFFFFF",
  "Height":111,
  "ImgFit":"yes"}');
  groundImage.RotationAngle=90;
  MyGameForm.SetImage(groundImage,' https://clomosy.com/WildRun/at2.png" rel="nofollow - https://clomosy.com/WildRun/at2.png ');
  clRTMethod(groundImage, 'SendToBack'); 
  groundImage.position.X=-MyGameForm.clHeight*12/10;
  
  backGroundImage = MyGameForm.AddNewProImage(MyGameForm,'backGroundImage');
  clComponent.SetupComponent(backGroundImage,'{
  "Align" : "alNone",
  "Width" :1500,
  "Height":750,
  "ImgFit":"yes"}');
  backGroundImage.RotationAngle=90;
  MyGameForm.SetImage(backGroundImage,' https://r.resimlink.com/2gDoj-Q.png" rel="nofollow - https://r.resimlink.com/2gDoj-Q.png ');
  clRTMethod(backGroundImage, 'SendToBack'); 
  
  
  spearTimer=MyGameForm.AddNewTimer(MyGameForm,'spearTimer',100);
  MyGameForm.AddNewEvent(spearTimer,tbeOnTimer,'SpearMove');
  spearTimer.enabled=true;
  
  MyGameForm.Run;
}



clIsIntersectsWith image'ler arasında aşırı mesafe olmasına rağmen aktif hale geliyor



Cevaplar:
Mesajı Yazan: Developer
Mesaj Tarihi: 21 Ağustos 2024 Saat 11:11
Merhaba Habib,
Mızrağı sadece aşağı yukarı hareketine göre zemine yaklaşınca dener misin?



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