tilemap offsets and scrolling help?

BlitzMax Forums/BlitzMax Beginners Area/tilemap offsets and scrolling help?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I didn't test this but try something like this

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.