scroll my map

BlitzPlus Forums/BlitzPlus Programming/scroll my map

Resolved

In your move map function you have:
map(x,y) = map(x,y) - 1   ;remember your using x to keep track of horizontal tile positions


Should be:
If x>0 Then
    map(x,y) = map(x - 1, y)
Else
    map(0,y) = map(24, y)
End If


The reason for the IF..THEN is so you don't place tile at a negative x location, instead place the 24th x-tile in the first x-position to wrap the screen.

with a map that wide (25*32) and at 800x600, there is nowhere to scroll. (25*32 = 800)

But rather than reassigning the array, I might be tempted to have a viewport with the top, left, width and height stored.

i.e. something like:

Type Viewport
   Field Top
   Field Left
   Field Width
   Field Height
End Type

CurrentView.Viewport = new Viewport

CurrentView\Top = 0
CurrentView\Left = 0
CurrentView\Width = 20
CurrentView\Height = 15


Then display only the tiles that are viewable.
To scroll the map, simply add or subtract to the top and left coords

ok trying now

Ok I have tried what you have put Andy but it just fills the screen with tiles.

WHat I want it to do is scroll the map up/down left/right. I know the tiles only fit 800,600 but cant i scroll in directions and keep the map the same.

just like moving a character but instead moving the whole map around.

In order to just scroll the map, you have to scroll to some destination.

It could be that you just wan't to scroll to a blank area or you could make the screen wrap, or you can scroll to a new area (needs map larger than the screen).

As a coder, you call the shots on how you want things to happen. Pick one of the above, and roll with it. :)

Cheers

lol! Short and precise. :) Thx for your help guys

Resolved