Rectsoverlap

Übersicht BlitzMax, BlitzMax NG Beginners-Corner

Neue Antwort erstellen

 

Mathe

Betreff: Rectsoverlap

BeitragSo, Jul 05, 2009 17:41
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi,

da BlitzMax kein Rectsoverlap hat muss man sich das ja selber schreiben nur bin ich heute irgendwie mal gar nicht in der lange richtig Nachzudenken, könnte mir jemand von euch mal einen kleinen Denkstoß verpassen?

So hät mein Code ausgeschaut funkt nicht so wie er soll Embarassed:
Code: [AUSKLAPPEN]
Function Rectsoverlap(x1,y1,w1,h1,x2,y2,w2,h2)
   For xA1 = x1 To (x1 + w1)
      For yA2 = y2 To (y2 + h2)
         If xA1 = x2 And y1 = yA2 Return true
         If xA1 = (x2 + w2) And y1 = yA2 Return True
         If xA1 = x2 And (y1 + h1) = yA2 Return True
         If xA1 = (x2 + w2) And (y1 + h1) = yA2 Return True
      next
   next
   For xA2 = x2 To (x2 + w1)
      For yA1 = y1 To (y1 + h2)
         If x1 = xA2 And yA1 = y2 Return true
         If (x1 + w1) = xA2 And yA1 = y2 Return True
         If x1 = xA2 And yA1 = (y2 + h2) Return True
         If (x1 + w1) = xA2 And yA1 = (y2 + h2) Return True
      next
   next   
   Return False
End Function


mfg.
Matthias
Windoof nein DANKE => ArchLinux Wink
  • Zuletzt bearbeitet von Mathe am So, Jul 05, 2009 18:00, insgesamt einmal bearbeitet

D2006

Administrator

BeitragSo, Jul 05, 2009 17:53
Antworten mit Zitat
Benutzer-Profile anzeigen
Schau doch einfach ins Codearchiv. Gibt's da schon.
Intel Core i5 2500 | 16 GB DDR3 RAM dualchannel | ATI Radeon HD6870 (1024 MB RAM) | Windows 7 Home Premium
Intel Core 2 Duo 2.4 GHz | 2 GB DDR3 RAM dualchannel | Nvidia GeForce 9400M (256 MB shared RAM) | Mac OS X Snow Leopard
Intel Pentium Dual-Core 2.4 GHz | 3 GB DDR2 RAM dualchannel | ATI Radeon HD3850 (1024 MB RAM) | Windows 7 Home Premium
Chaos Interactive :: GoBang :: BB-Poker :: ChaosBreaker :: Hexagon :: ChaosRacer 2
 

Mathe

BeitragSo, Jul 05, 2009 18:02
Antworten mit Zitat
Benutzer-Profile anzeigen
Ohhh hab heute genau einen Eintrag (Forumsuche) übersehen und der war genau der den ich gebraucht hätte, eigentlich hät man auch selber auf die Formel kommen können ^^.
Windoof nein DANKE => ArchLinux Wink

beanage.johannes

BeitragSo, Jul 05, 2009 21:13
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]
Function RectCollide:Int(x1:Int,y1:Int,w1:Int,h1:Int,x2:Int,y2:Int,w2:Int,h2:Int)

   If (x1 + w1) > x2 Then
      If (y1 + h1) > y2 Then
         If x1 < (w2 + x2) And y1 < (h2 + y2) Then
            Return 1
         EndIf
      EndIf
   EndIf
      
EndFunction

Neue Antwort erstellen


Übersicht BlitzMax, BlitzMax NG Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group