2D TileMap Scrolling
Blitz3D Forums/Blitz3D Programming/2D TileMap Scrolling
| ||
Okay I know this isn't a 3D question, but I use Blitz3D Anyways, Im trying to come up with a better and yet smoother way to do scrolling, basicly I have it incressing the MapX and MapY when the play reaches a certain point on the screen, and I just move the map underme, but for some reason it seem to be to restrected.. so im looking for a smoother and more open scroll.. :EDIT: thought about it I want to be able to foces the camera ( view on the player ) and have the map move along with him.. |
| ||
I think you should do something like:playertilex=int(player_x/tilewith) playertiley=int(player_y/tileheight) for a=playertilex-aconstant1 to playertilex+aconstant2 for b=playertiley-aconstant3 to playertiley+aconstant4 drawimage maptile(a,b),a*tilewith-player_x+~½screenwith,b*tileheight-player_y+~½screenwith next next drawimage player,~½screenwith,~½screenheight You'll need to alter this code to fit into your program, I have presumed that you use an array to store the map data. |