Hélas, j'avais déjà testé le flag...
Pour que vous puissiez tester (Pb v. 3.93) :
Code : Tout sélectionner
InitSprite()
OpenWindow(0,0,0,800,600,#PB_Window_ScreenCentered,"Essai")
OpenWindowedScreen(WindowID(),0,0,800,600,0,0,0)
spriteX=0
spriteY=0
click=0
ClearScreen(255,255,255)
Repeat
x = WindowMouseX()
y = WindowMouseY()
Event = WaitWindowEvent()
If Event=#WM_LButtonDown
click=1
EndIf
If Event=#WM_LButtonUp
click=0
EndIf
If click=1
If spriteX>0 And x>=650 And x<=680 And y>=457 And y<=477
spriteX=spriteX-10
ElseIf spriteX<570 And x>=720 And x<=750 And y>=457 And y<=477
spriteX=spriteX+10
ElseIf spriteY>0 And x>=692 And x<=712 And y>=415 And y<=445
spriteY=spriteY-10
ElseIf spriteY<570 And x>=692 And x<=712 And y>=485 And y<=515
spriteY=spriteY+10
EndIf
EndIf
StartDrawing(ScreenOutput())
Locate(620,0)
DrawText("Utilisez la croix")
Locate(620,20)
DrawText("pour dépacer le carré")
Locate(620,60)
DrawText("Right-click pour terminer")
Box(spriteX,spriteY,30,30,RGB(0,0,0))
Box(600,0,10,600,(RGB(0,0,0)))
Box(650,457,100,20,RGB(0,0,0))
Box(692,415,20,100,RGB(0,0,0))
If x>=650 And x<=680 And y>=457 And y<=477
LineXY(655, 467, 665, 472, RGB(255,0,0))
LineXY(655, 467, 665, 462, RGB(255,0,0))
LineXY(665, 472, 665, 462, RGB(255,0,0))
FillArea(661,467,RGB(255,0,0),RGB(255,0,0))
Else
LineXY(655, 467, 665, 472, RGB(255,255,255))
LineXY(655, 467, 665, 462, RGB(255,255,255))
LineXY(665, 472, 665, 462, RGB(255,255,255))
FillArea(661,467,RGB(255,255,255),RGB(255,255,255))
EndIf
If x>=720 And x<=750 And y>=457 And y<=477
LineXY(745, 467, 735, 472 , RGB(255,0,0))
LineXY(745, 467, 735, 462 , RGB(255,0,0))
LineXY(735, 472, 735, 462 , RGB(255,0,0))
FillArea(739,467,RGB(255,0,0),RGB(255,0,0))
Else
LineXY(745, 467, 735, 472 , RGB(255,255,255))
LineXY(745, 467, 735, 462 , RGB(255,255,255))
LineXY(735, 472, 735, 462 , RGB(255,255,255))
FillArea(739,467,RGB(255,255,255),RGB(255,255,255))
EndIf
If x>=692 And x<=712 And y>=415 And y<=445
LineXY(702, 420, 707, 430, RGB(255,0,0))
LineXY(702, 420, 697, 430, RGB(255,0,0))
LineXY(697, 430, 707, 430, RGB(255,0,0))
FillArea(702,425,RGB(255,0,0),RGB(255,0,0))
Else
LineXY(702, 420, 707, 430, RGB(255,255,255))
LineXY(702, 420, 697, 430, RGB(255,255,255))
LineXY(697, 430, 707, 430, RGB(255,255,255))
FillArea(702,425,RGB(255,255,255),RGB(255,255,255))
EndIf
If x>=692 And x<=712 And y>=485 And y<=515
LineXY(702, 510, 707, 500, RGB(255,0,0))
LineXY(702, 510, 697, 500, RGB(255,0,0))
LineXY(697, 500, 707, 500, RGB(255,0,0))
FillArea(702,505,RGB(255,0,0),RGB(255,0,0))
Else
LineXY(702, 510, 707, 500, RGB(255,255,255))
LineXY(702, 510, 697, 500, RGB(255,255,255))
LineXY(697, 500, 707, 500, RGB(255,255,255))
FillArea(702,505,RGB(255,255,255),RGB(255,255,255))
EndIf
StopDrawing()
FlipBuffers()
ClearScreen(255,255,255)
Delay(1)
Until Event=#WM_RButtonDown
Essayez de cliquer sur la croix directionnelle (sans bouger la souris pendant le clique !) et vous allez voir : le sprite (enfin dans le jeu c'est un sprite, là c'est juste une box()) reste bêtement immobile !