mfg. marvin133

Code: Alles auswählen
OpenWindow(0, 50,50, 600, 400, "Box", #PB_Window_SystemMenu |#PB_Window_MaximizeGadget |#PB_Window_MinimizeGadget )
InitKeyboard()
InitSprite()
OpenWindowedScreen(WindowID(0), 0, 0,600,400, 1, 1, 20)
Repeat
ExamineKeyboard()
FlipBuffers()
GrabSprite(0,0,0,25,25,0)
StartDrawing(WindowOutput(0))
Box(x,y,25,25,RGB(0,0,250))
StopDrawing()
DisplaySprite(0,50,150)
If KeyboardPushed(#PB_Key_Right)
x=x+10
If x>=600
x=0
EndIf
EndIf
If KeyboardPushed(#PB_Key_Left)
x=x-10
If x<=0
x=599
EndIf
EndIf
If KeyboardPushed(#PB_Key_Down)
y=y+10
If y>=400
y=0
EndIf
EndIf
If KeyboardPushed(#PB_Key_Up)
y=y-10
If y<=0
y=399
EndIf
EndIf
Until WaitWindowEvent() = #PB_Event_CloseWindow