Blöcke verschieben... von ???
Mal was für Noobs gecodet (ohne tieferen Sinn)...

[code:1:84dd24190c]Type Blox
Field x, y
Field width, height
Field Red, Green, Blue
End Type
;========================================================================
Global Mousedrag.Blox, mx, my
;========================================================================
Graphics 640,480
SetBuffer BackBuffer()

MakeBlox(50)

While Not KeyHit(1)
Cls
ControlBlox()
mx=MouseX()
my=MouseY()
DrawBlox()
DrawMouse()
Flip
Wend
End
;========================================================================
;========================================================================
Function ControlBlox()
Local B.Blox
If Mousedrag=Null Then
If MouseHit(1) Then
B = Last Blox
While B<>Null
If RectsOverlap(mx,my,1,1,Bx,By,Bwidth,Bheight) Then
Insert B After Last Blox
Mousedrag = B
B = First Blox
EndIf
B = Before B
Wend
EndIf
Else
If MouseDown(1) Then
Mousedragx=Mousedragx+MouseX()-mx
Mousedragy=Mousedragy+MouseY()-my
Else
Mousedrag=Null
EndIf
EndIf
End Function
;========================================================================
Function DrawBlox()
Local B.Blox
For B = Each Blox
Color BRed,BGreen,BBlue
Rect Bx,By,Bwidth,Bheight,1
Next
End Function
;========================================================================
Function DrawMouse()
Color 0,Abs(MilliSecs()/2 Mod 500-250),255
Line mx,my,mx+7,my
Line mx+7,my,mx,my+7
Line mx,my+7,mx,my
End Function
;========================================================================
Function MakeBlox(n)
Local B.Blox
SeedRnd(MilliSecs())
For i = 1 To n
B = New Blox
Bx = Rand(0,600)
By = Rand(0,440)
Bwidth = Rand(20,40)
Bheight = Rand(20,40)
BRed = Rand(0,255)
BGreen = Rand(0,255)
BBlue = Rand(0,255)
Next
End Function[/code:1:84dd24190c]

PS: Oberon sux! :evil:



Suche:
(unterstützt mySQL Wildcards ala %)
Titel:
Text:
Autor: