Mon problème est que tout va bien quand je fait un déplacement positif par rapport au axe x et y, mais quand j'esseye de faire un déplacement n'egatif et bien sa ne marche plus

Voici le code : (pas de média c'est juste des box avec draw

InitSprite ()
InitKeyboard ()
x = 10
y = 384
x_pnj = 50
y_pnj = 10
temp=50
temp2=50
OpenScreen (1024, 768, 32, "Test rpg" )
Repeat
FlipBuffers ()
ClearScreen (black)
StartDrawing ( ScreenOutput ())
Box (400, 50, 50, 50, RGB (0, 0, 255))
Box (300, 5, 250, 75, RGB (114, 238, 141))
Box (x_pnj, y_pnj, 50, 50, RGB (0, 0, 255))
Box (600, 618, 50, 50, RGB (0, 0, 255))
Box (512.5, 643, 175, 125, RGB (204, 51, 51))
Box (x, y, 50, 50, RGB (241, 233, 14))
StopDrawing ()
ExamineKeyboard ()
If KeyboardPushed ( #PB_Key_Up )
y-3
;La touche droite du curseur est appuyée
ElseIf KeyboardPushed ( #PB_Key_Right )
x+3
;La touche bas du curseur est appuyée
ElseIf KeyboardPushed ( #PB_Key_Down )
y+3
;La touche gauche du curseur est appuyée
ElseIf KeyboardPushed ( #PB_Key_Left )
x-3
EndIf
If x_pnj < 240
x_pnj+5
ElseIf x_pnj >= 240 And y_pnj < 115
y_pnj+5
ElseIf y_pnj >= 115 And x_pnj < 400
x_pnj+5
ElseIf x_pnj >= 400
If temp<>0
temp-1
EndIf
EndIf
If temp=0
If x_pnj >= 400 And y_pnj < 450
y_pnj+5
ElseIf y_pnj >= 450 And x_pnj < 600
x_pnj+5
ElseIf x_pnj >= 600 And y_pnj < 557
y_pnj+5
ElseIf y_pnj >= 557
If temp2<>0
temp2-1
EndIf
EndIf
EndIf
If temp2=0
If y_pnj >= 557 And x_pnj > 500
x_pnj-5
EndIf
EndIf
Until KeyboardPushed ( #PB_Key_Escape )
Voila donc tout va bien, sauf au moment où il doit repartir de son dernier arret, je fait donc y_pnj-5 et il decale juste un peu le box alors qu'il devrais aller jusque 500 sur l'axe des y

J'espere que quelqu'un pourra m'aider (ce qui est plus que probable).
Merci d'avance pour votre aide.