I didn't test this but try something like this
BTW you should really use constants or vars for the tile width and height instead of hard coding 32.
Function scroll_map() If KeyDown(KEY_LEFT) then scrollx:-3 If KeyDown(KEY_RIGHT) then scrollx:+3 If KeyDown(KEY_UP) then scrolly:-3 If KeyDown(KEY_DOWN) then scrolly:+3 if scrollx+(mapx*32)<GraphicsWidth() then scrollx= -((mapx*32)-GraphicsWidth()) if scrolly+(mapy*32)<GraphicsHeight() then scrolly= -((mapy*32)-GraphicsHeight()) if scrollx>0 then scrollx=0 if scrolly>0 then scrolly=0 End Function
BTW you should really use constants or vars for the tile width and height instead of hard coding 32.