<?xml version="1.0" encoding="iso-8859-9" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Clomosy | Forum : Çarpışma Olmadığı Halde Olmuş Gibi Bildirim Verme</title>
  <link>https://forum.clomosy.com.tr/</link>
  <description><![CDATA[XML içerik linki; Clomosy | Forum : Genel &#304;&#351;lemler : Çarpışma Olmadığı Halde Olmuş Gibi Bildirim Verme]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 04 May 2026 08:58:06 +0000</pubDate>
  <lastBuildDate>Thu, 11 Jul 2024 14:44:39 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.07</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>https://forum.clomosy.com.tr/RSS_post_feed.asp?TID=642</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Clomosy | Forum]]></title>
   <url>https://forum.clomosy.com.tr/forum_images/logo.png</url>
   <link>https://forum.clomosy.com.tr/</link>
  </image>
  <item>
   <title><![CDATA[Çarpışma Olmadığı Halde Olmuş Gibi Bildirim Verme : var MyForm: TclGameForm; ImgBall,...]]></title>
   <link>https://forum.clomosy.com.tr/forum_posts.asp?TID=642&amp;PID=952#952</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="https://forum.clomosy.com.tr/member_profile.asp?PF=200">steelwing</a><br /><strong>Konu:</strong> 642<br /><strong>Gönderim Zamanı:</strong> 11&nbsp;Temmuz&nbsp;2024 Saat 14:44<br /><br /><div>var</div><div>&nbsp; MyForm: TclGameForm;</div><div>&nbsp; ImgBall, ImgHole, Imgmeteor, Imgmeteor2, Imgmeteor3: TclProImage;</div><div>&nbsp; DeviceMotionSensor: TClMotionSensor;</div><div>&nbsp; LblDisplay: TclLabel;</div><div>&nbsp; GameTimer, MeteorTimer: TclTimer;</div><div>&nbsp; BtnStartGame: TclButton;</div><div>&nbsp; geribtn: TClProButton;</div><div>&nbsp; SoundIndex: Integer;</div><div>&nbsp; myDeviceManager: TclDeviceManager;</div><div>&nbsp; HoleMin_X, HoleMax_X: Single; // Ball must be placed inside these coordinates</div><div>&nbsp; HoleMin_Y, HoleMax_Y: Single;</div><div>&nbsp; number, BallSpeed: Integer;</div><div>&nbsp; meteorSpeed: Single; // Variable for meteor movement</div><div>&nbsp; meteorDirection1, meteorDirection2, meteorDirection3: Integer; // Directions for meteors</div><div><br></div><div>procedure geriprcdr;</div><div>begin</div><div>&nbsp; TclProButton(MyForm.clFindComponent('BtnGoBack')).Click;</div><div>end;</div><div><br></div><div>function isBallinTheHole: Boolean;</div><div>var</div><div>&nbsp; centX, CentY: Single;</div><div>begin</div><div>&nbsp; Result := False;</div><div>&nbsp; centX := ImgBall.Position.X + (ImgBall.Width / 2);</div><div>&nbsp; centY := ImgBall.Position.Y + (ImgBall.Height / 2);</div><div>&nbsp; if (centX &lt;= HoleMax_X) and (centX &gt;= HoleMin_X) and</div><div>&nbsp; &nbsp; &nbsp;(centY &lt;= HoleMax_Y) and (centY &gt;= HoleMin_Y) then</div><div>&nbsp; &nbsp; Result := True;</div><div>end;</div><div><br></div><div>function isBallCrashed: Boolean;</div><div>begin</div><div>&nbsp; Result := False;</div><div><br></div><div>&nbsp; if (ImgBall.Position.X + ImgBall.Width &gt; Imgmeteor.Position.X) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.X &lt; Imgmeteor.Position.X + Imgmeteor.Width) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.Y + ImgBall.Height &gt; Imgmeteor.Position.Y) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.Y &lt; Imgmeteor.Position.Y + Imgmeteor.Height) then</div><div>&nbsp; begin</div><div>&nbsp; &nbsp; Result := True;</div><div>&nbsp; &nbsp; Exit;</div><div>&nbsp; end;</div><div><br></div><div>&nbsp; if (ImgBall.Position.X + ImgBall.Width &gt; Imgmeteor2.Position.X) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.X &lt; Imgmeteor2.Position.X + Imgmeteor2.Width) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.Y + ImgBall.Height &gt; Imgmeteor2.Position.Y) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.Y &lt; Imgmeteor2.Position.Y + Imgmeteor2.Height) then</div><div>&nbsp; begin</div><div>&nbsp; &nbsp; Result := True;</div><div>&nbsp; &nbsp; Exit;</div><div>&nbsp; end;</div><div><br></div><div>&nbsp; if (ImgBall.Position.X + ImgBall.Width &gt; Imgmeteor3.Position.X) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.X &lt; Imgmeteor3.Position.X + Imgmeteor3.Width) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.Y + ImgBall.Height &gt; Imgmeteor3.Position.Y) and</div><div>&nbsp; &nbsp; &nbsp;(ImgBall.Position.Y &lt; Imgmeteor3.Position.Y + Imgmeteor3.Height ) then</div><div>&nbsp; begin</div><div>&nbsp; &nbsp; Result := True;</div><div>&nbsp; &nbsp; Exit;</div><div>&nbsp; end;</div><div>end;</div><div><br></div><div>procedure randomNumber;</div><div>begin</div><div>&nbsp; number := Random(TForm(MyForm).ClientWidth);</div><div>end;</div><div><br></div><div>procedure MoveMeteors;</div><div>begin</div><div>&nbsp; // Update meteor positions</div><div>&nbsp; Imgmeteor.Position.X := Imgmeteor.Position.X + (meteorSpeed * meteorDirection1);</div><div>&nbsp; Imgmeteor2.Position.X := Imgmeteor2.Position.X + (meteorSpeed * meteorDirection2);</div><div>&nbsp; Imgmeteor3.Position.X := Imgmeteor3.Position.X + (meteorSpeed * meteorDirection3);</div><div><br></div><div>&nbsp; // Check boundaries and reverse direction if needed</div><div>&nbsp; if (Imgmeteor.Position.X &lt;= 0) or (Imgmeteor.Position.X + Imgmeteor.Width &gt;= TForm(MyForm).ClientWidth) then</div><div>&nbsp; &nbsp; meteorDirection1 := -meteorDirection1;</div><div><br></div><div>&nbsp; if (Imgmeteor2.Position.X &lt;= 0) or (Imgmeteor2.Position.X + Imgmeteor2.Width &gt;= TForm(MyForm).ClientWidth) then</div><div>&nbsp; &nbsp; meteorDirection2 := -meteorDirection2;</div><div><br></div><div>&nbsp; if (Imgmeteor3.Position.X &lt;= 0) or (Imgmeteor3.Position.X + Imgmeteor3.Width &gt;= TForm(MyForm).ClientWidth) then</div><div>&nbsp; &nbsp; meteorDirection3 := -meteorDirection3;</div><div>end</div><div><br></div><div>procedure ProcOnGameTimer;</div><div>const</div><div>&nbsp; BallSpeed = 5;</div><div>begin</div><div>&nbsp; if Clomosy.PlatformIsMobile then</div><div>&nbsp; begin</div><div>&nbsp; &nbsp; case DeviceMotionSensor.GetDirectionX of</div><div>&nbsp; &nbsp; &nbsp; 1: ImgBall.Position.X := ImgBall.Position.X - BallSpeed; // Move left</div><div>&nbsp; &nbsp; &nbsp; 2: ImgBall.Position.X := ImgBall.Position.X + BallSpeed; // Move right</div><div>&nbsp; &nbsp; end;</div><div><br></div><div>&nbsp; &nbsp; case DeviceMotionSensor.GetDirectionY of</div><div>&nbsp; &nbsp; &nbsp; 1: ImgBall.Position.Y := ImgBall.Position.Y + BallSpeed; // Move up</div><div>&nbsp; &nbsp; &nbsp; 2: ImgBall.Position.Y := ImgBall.Position.Y - BallSpeed; // Move down</div><div>&nbsp; &nbsp; end;</div><div><br></div><div>&nbsp; &nbsp; if (ImgBall.Position.X + ImgBall.Width &gt; TForm(MyForm).ClientWidth) then</div><div>&nbsp; &nbsp; &nbsp; ImgBall.Position.X := TForm(MyForm).ClientWidth - ImgBall.Width;</div><div>&nbsp; &nbsp; if (ImgBall.Position.X &lt; 0) then</div><div>&nbsp; &nbsp; &nbsp; ImgBall.Position.X := 0;</div><div>&nbsp; &nbsp; if (ImgBall.Position.Y + ImgBall.Height &gt; TForm(MyForm).ClientHeight) then</div><div>&nbsp; &nbsp; &nbsp; ImgBall.Position.Y := TForm(MyForm).ClientHeight - ImgBall.Height;</div><div>&nbsp; &nbsp; if (ImgBall.Position.Y &lt; 0) then</div><div>&nbsp; &nbsp; &nbsp; ImgBall.Position.Y := 0;</div><div><br></div><div>&nbsp; &nbsp; if isBallinTheHole then</div><div>&nbsp; &nbsp; begin</div><div>&nbsp; &nbsp; &nbsp; GameTimer.Enabled := False;</div><div>&nbsp; &nbsp; &nbsp; ImgBall.Position.X := HoleMin_X * 1.75;</div><div>&nbsp; &nbsp; &nbsp; ImgBall.Position.Y := HoleMin_Y;</div><div>&nbsp; &nbsp; &nbsp; if Clomosy.PlatformIsMobile then</div><div>&nbsp; &nbsp; &nbsp; &nbsp; DeviceMotionSensor.Active := False; // game stopped</div><div>&nbsp; &nbsp; &nbsp; BtnStartGame.Text := 'START GAME';</div><div>&nbsp; &nbsp; &nbsp; MyForm.PlayGameSound(SoundIndex);</div><div>&nbsp; &nbsp; &nbsp; myDeviceManager.Vibrate(1000);</div><div>&nbsp; &nbsp; &nbsp; ShowMessage('Tebrikler');</div><div>&nbsp; &nbsp; &nbsp; randomNumber;</div><div>&nbsp; &nbsp; end</div><div>&nbsp; &nbsp; else if isBallCrashed then</div><div>&nbsp; &nbsp; begin</div><div>&nbsp; &nbsp; &nbsp; GameTimer.Enabled := False;</div><div>&nbsp; &nbsp; &nbsp; MeteorTimer.Enabled := False;</div><div>&nbsp; &nbsp; &nbsp; if Clomosy.PlatformIsMobile then</div><div>&nbsp; &nbsp; &nbsp; &nbsp; DeviceMotionSensor.Active := False; // game stopped</div><div>&nbsp; &nbsp; &nbsp; ShowMessage('Tekrar deneyiniz');</div><div>&nbsp; &nbsp; &nbsp; BtnStartGame.Text := 'START GAME';</div><div>&nbsp; &nbsp; end;</div><div>&nbsp; end;</div><div>end;</div><div><br></div><div>procedure MeteorTimerProc;</div><div>begin</div><div>&nbsp; // Update meteor positions</div><div>&nbsp; MoveMeteors;</div><div>end;</div><div><br></div><div>procedure BtnStartGameClick;</div><div>begin</div><div>&nbsp; GameTimer.Enabled := not GameTimer.Enabled;</div><div><br></div><div>&nbsp; if GameTimer.Enabled then</div><div>&nbsp; &nbsp; BtnStartGame.Text := 'STOP GAME'</div><div>&nbsp; else</div><div>&nbsp; &nbsp; BtnStartGame.Text := 'START GAME';</div><div><br></div><div>&nbsp; if GameTimer.Enabled then</div><div>&nbsp; begin</div><div>&nbsp; &nbsp; ImgBall.Align := alNone;</div><div>&nbsp; &nbsp; ImgBall.Position.X := number;</div><div>&nbsp; &nbsp; ImgBall.Position.Y := 0;</div><div>&nbsp; &nbsp; if Clomosy.PlatformIsMobile then</div><div>&nbsp; &nbsp; &nbsp; DeviceMotionSensor.Active := True;</div><div>&nbsp; &nbsp; MeteorTimer.Enabled := True;</div><div>&nbsp; end else</div><div>&nbsp; begin</div><div>&nbsp; &nbsp; if Clomosy.PlatformIsMobile then</div><div>&nbsp; &nbsp; &nbsp; DeviceMotionSensor.Active := False; // game stopped</div><div>&nbsp; &nbsp; MeteorTimer.Enabled := False;</div><div>&nbsp; end;</div><div>&nbsp; end;</div><div><br></div><div>procedure InitializeComponents;</div><div>begin</div><div>&nbsp; MyForm := TclGameForm.Create(Self);</div><div>&nbsp; myDeviceManager := TclDeviceManager.Create;</div><div>&nbsp; MyForm.SetFormBGImage('<a href="https://clomosy.com/educa/bg3.png" target="_blank" rel="nofollow">https://clomosy.com/educa/bg3.png</a>');</div><div>&nbsp; MyForm.AddGameAssetFromUrl('<a href="https://www.clomosy.com/game/assets/win.wav" target="_blank" rel="nofollow">https://www.clomosy.com/game/assets/win.wav</a>');</div><div>&nbsp; SoundIndex := MyForm.RegisterSound('win.wav');</div><div>&nbsp; MyForm.SoundIsActive := True;</div><div><br></div><div>&nbsp; LblDisplay := MyForm.AddNewLabel(MyForm, 'LblDisplay', '--');</div><div>&nbsp; LblDisplay.Align := alTop;</div><div>&nbsp; LblDisplay.Visible := False;</div><div><br></div><div>&nbsp; BtnStartGame := MyForm.AddNewButton(MyForm, 'BtnStartGame', 'START GAME');</div><div>&nbsp; BtnStartGame.Align := alBottom;</div><div>&nbsp; BtnStartGame.Height := 30;</div><div>&nbsp; BtnStartGame.StyledSettings := ssFamily;</div><div>&nbsp; BtnStartGame.TextSettings.FontColor := clAlphaColor.clHexToColor('#FFFFFF');</div><div>&nbsp; BtnStartGame.Margins.Bottom := 50;</div><div>&nbsp; MyForm.AddNewEvent(BtnStartGame, tbeOnClick, 'BtnStartGameClick');</div><div><br></div><div>&nbsp; geribtn := MyForm.AddNewProButton(MyForm, 'geribtn', '');</div><div>&nbsp; clComponent.SetupComponent(geribtn, '{"Align" : "None","Width":70,"Height":50,"ImgUrl":"<a href="https://clomosy.com/demos/goback.png" target="_blank" rel="nofollow">https://clomosy.com/demos/goback.png"</a>}');</div><div>&nbsp; MyForm.AddNewEvent(geribtn, tbeOnClick, 'geriprcdr');</div><div>&nbsp; geribtn.Position.X := 5;</div><div>&nbsp; geribtn.Position.Y := 7;</div><div><br></div><div>&nbsp; ImgHole := MyForm.AddNewProImage(MyForm, 'ImgHole');</div><div>&nbsp; ImgHole.clSetImage('<a href="https://clomosy.com/educa/stati&#111;n.png" target="_blank" rel="nofollow">https://clomosy.com/educa/station.png</a>');</div><div>&nbsp; ImgHole.Margins.Top := 120;</div><div>&nbsp; ImgHole.Properties.AutoSize := True;</div><div>&nbsp; ImgHole.Align := alCenter;</div><div><br></div><div>&nbsp; ImgBall := MyForm.AddNewProImage(MyForm, 'ImgBall');</div><div>&nbsp; ImgBall.clSetImage('<a href="https://clomosy.com/educa/ufo.png" target="_blank" rel="nofollow">https://clomosy.com/educa/ufo.png</a>');</div><div>&nbsp; ImgBall.Width := 50;</div><div>&nbsp; ImgBall.Height := 50;</div><div>&nbsp; ImgBall.Align := alCenter;</div><div><br></div><div>&nbsp; Imgmeteor := MyForm.AddNewProImage(MyForm, 'Imgmeteor');</div><div>&nbsp; Imgmeteor.clSetImage('<a href="https://i.imgur.com/7nBXGfb.png" target="_blank" rel="nofollow">https://i.imgur.com/7nBXGfb.png</a>');</div><div>&nbsp; Imgmeteor.Width := 150;</div><div>&nbsp; Imgmeteor.Height := 270;</div><div>&nbsp; Imgmeteor.Align := alNone;</div><div>&nbsp; Imgmeteor.Position.X := 200;</div><div>&nbsp; Imgmeteor.Position.Y := 370;</div><div>&nbsp; Imgmeteor.RotationAngle := -90;</div><div><br></div><div>&nbsp; Imgmeteor2 := MyForm.AddNewProImage(MyForm, 'Imgmeteor2');</div><div>&nbsp; Imgmeteor2.clSetImage('<a href="https://i.imgur.com/7nBXGfb.png" target="_blank" rel="nofollow">https://i.imgur.com/7nBXGfb.png</a>');</div><div>&nbsp; Imgmeteor2.Width := 100;</div><div>&nbsp; Imgmeteor2.Height := 100;</div><div>&nbsp; Imgmeteor2.Align := alNone;</div><div>&nbsp; Imgmeteor2.Position.X := 10;</div><div>&nbsp; Imgmeteor2.Position.Y := 120;</div><div>&nbsp; Imgmeteor2.RotationAngle := -270;</div><div><br></div><div>&nbsp; Imgmeteor3 := MyForm.AddNewProImage(MyForm, 'Imgmeteor3');</div><div>&nbsp; Imgmeteor3.clSetImage('<a href="https://i.imgur.com/7nBXGfb.png" target="_blank" rel="nofollow">https://i.imgur.com/7nBXGfb.png</a>');</div><div>&nbsp; Imgmeteor3.Width := 150;</div><div>&nbsp; Imgmeteor3.Height := 50;</div><div>&nbsp; Imgmeteor3.Align := alNone;</div><div>&nbsp; Imgmeteor3.Position.X := 100;</div><div>&nbsp; Imgmeteor3.Position.Y := 50;</div><div>&nbsp; Imgmeteor3.RotationAngle := -180;</div><div><br></div><div>&nbsp; HoleMin_X := ImgBall.Position.X / 1.75;</div><div>&nbsp; HoleMax_X := HoleMin_X + (ImgBall.Width * 5); // Ball must be placed inside these coordinates</div><div>&nbsp; HoleMin_Y := ImgBall.Position.Y + 18; // LblDisplay.Visible true oldugunda orta nokta alınırken android de yanlış hesaplanıyor</div><div>&nbsp; HoleMax_Y := HoleMin_Y + ImgBall.Height;</div><div>&nbsp; ImgBall.Position.Y := HoleMin_Y;</div><div><br></div><div>&nbsp; DeviceMotionSensor := MyForm.AddNewSensorsMotion(MyForm, 'DeviceMotionSensor');</div><div><br></div><div>&nbsp; GameTimer := MyForm.AddNewTimer(MyForm, 'GameTimer', 1000);</div><div>&nbsp; GameTimer.Interval := 30; // 30 milliseconds interval</div><div>&nbsp; GameTimer.Enabled := False;</div><div>&nbsp; MyForm.AddNewEvent(GameTimer, tbeOnTimer, 'ProcOnGameTimer');</div><div><br></div><div>&nbsp; MeteorTimer := MyForm.AddNewTimer(MyForm, 'MeteorTimer', 10);</div><div>&nbsp; MeteorTimer.Interval := 10; // 10 milliseconds interval for meteor movement</div><div>&nbsp; MeteorTimer.Enabled := True;</div><div>&nbsp; MyForm.AddNewEvent(MeteorTimer, tbeOnTimer, 'MeteorTimerProc');</div><div><br></div><div>&nbsp; // Initialize meteor directions</div><div>&nbsp; meteorDirection1 := 1; // Move right initially</div><div>&nbsp; meteorDirection2 := 1; // Move right initially</div><div>&nbsp; meteorDirection3 := 1; // Move right initially</div><div><br></div><div>&nbsp; meteorSpeed := 1; // Set meteor speed</div><div><br></div><div>&nbsp; if Clomosy.PlatformIsMobile then&nbsp;</div><div>&nbsp; &nbsp; MyForm.Run;</div><div>end;</div><div><br></div><div>begin</div><div>&nbsp; InitializeComponents;</div><div>end;</div><div><br></div>]]>
   </description>
   <pubDate>Thu, 11 Jul 2024 14:44:39 +0000</pubDate>
   <guid isPermaLink="true">https://forum.clomosy.com.tr/forum_posts.asp?TID=642&amp;PID=952#952</guid>
  </item> 
 </channel>
</rss>