yes.. that is just how I would do it. store a locationXOffset, locationYOffset.
Then when checking for the keypresses add/subtract values from the offset values.
Then add some code to check the offset values to decide if the locationX, locationY values need to be changed.
eg.
if locationXOffset < 0 then
locationXOffset = locationXOffset + 64
locationX = locationX - 1
end if
if locationXOffset > 63 then
locationXOffset = locationXOffset - 64
locationX = locationX + 1
end if
and the same from the y values.
If you are wondering why I am checking for < 0 and adding 64 or checking for > 63 and subtracting 64 I have found its a nice way to cater for various speeds of scrolling.
That code will work even if you move 2,3,4 + pixels at a time up to a maximum of a full tile size.
Then when checking for the keypresses add/subtract values from the offset values.
Then add some code to check the offset values to decide if the locationX, locationY values need to be changed.
eg.
if locationXOffset < 0 then
locationXOffset = locationXOffset + 64
locationX = locationX - 1
end if
if locationXOffset > 63 then
locationXOffset = locationXOffset - 64
locationX = locationX + 1
end if
and the same from the y values.
If you are wondering why I am checking for < 0 and adding 64 or checking for > 63 and subtracting 64 I have found its a nice way to cater for various speeds of scrolling.
That code will work even if you move 2,3,4 + pixels at a time up to a maximum of a full tile size.