simple Kollisions abfrage von ??? |
ich dachte mir mal, da ich momentan eh nichts tue, schreib ich mal eine einfache kollisions routine, die ihr gerne verändern dürft. [code:1:5311666c23] ;Einfache Image Overlap Kolli-Abfrage von Anquav-Hero Graphics 800,600,16,1 ;graphics modus einstellen x=400;Bild x y=300;bild y bildx=50; bild breite bildy=50; bild höhe Bild = CreateImage (bildx,bildy);bild erstellen SetBuffer ImageBuffer (Bild);imagebuffer aktivieren For a = 0 To 119 Color a*2,a*2,255 Line 0,a,159,a;Zeug malen Next Color 0,0,0 Line 0,2,159,2 Line 0,3,159,3 Line 0,4,159,4 Line 0,5,159,5 SetBuffer FrontBuffer() While Not KeyHit(1) Cls For xi=0 To bildx For yi=0 To bildy If xi+x=MouseX() And yi+y=MouseY();Bedingung zur kollision Color 255,0,0 Text 300,10,"Overlap Kollision!";Text ausgeben EndIf Next Next DrawImage bild,x,y;Zeichenen des bildes Color 255,255,0 Plot MouseX(),MouseY();plot bei maus x und y Flip Wend [/code:1:5311666c23] viel spaß damit! |
....... von ??? |
Hrmpf...Sehr gute Lösung :wink: [code:1:91b69fd9a6] If MouseX()>x And MouseX()<x+bildx And MouseY()>y And MouseY()<y+bildy Text 100,100, "Colli" EndIf [/code:1:91b69fd9a6] Übersichtlicher, 4 mal schneller als deine Lösung. Denke das nächste mal mehr nach. bye |
von ??? |
^_^ |
von ??? |
war ja nur aus verlegenheit gemacht aber wie ihr wollt, es war ja nur so ne idee :lol: |