Do you want to zoom in our out of your map during the game this may be for you.
Simple cart to show off the zoom function.
Cursor keys to scroll x/z to zoom in and out.
actual function is as follows
--prints the map zoomed -- zoom is the zoom factor 2 for twice as big -- 0.5 for half as big -- mx = the pixel cordiante of the map to start -- my = the pixel cordiante of the map to start -- sx = screen offset x -- sy = screen offset y function zmap(zoom,mx,my,sx,sy) zoom = zoom or 1 mx= mx or 0 my= my or 0 sx= sx or 0 sy= sy or 0 for i=0, 127 do tline(0,i,127, i, mx, my+i/8/zoom, 1/8/zoom) end end |
Please feel free to adapt for your own projects.
A better version of this could use a screen clipping rectangle but I wasn't sure if it was necessary or not
[Please log in to post a comment]