How many tipe of scrolling are possible with Blitz?
BlitzPlus Forums/BlitzPlus Programming/How many tipe of scrolling are possible with Blitz?
| ||
Sorry for the silly question...but i'm thinking if the only scrolling possible are achieved with the command "origin".... Are there other methods for scrolling both larger image and tiled backgrounds? In all the demo i see the scrolling aren't made of "origin" because in the code i didn't see this command,but i don't figured out in wath method is made... |
| ||
plenty of methods tileimage image[,x,y] if you modify the x and y params you can scroll that way. can also do it another way if you are drawing your images from a tilemap in an array, like this: (tiles are 16x16) dim map(100,100) function drawmap(ox,oy) for x = 0 to 100 for y = 0 to 100 screenx = x*16 + ox screeny = y*16 + oy if (screenx >= 0) and (screeny >= 0) and (screenx <= graphicswidth()) and (screeny <= graphicsheight()) drawimage map(x,y),screenx,screeny end if next next end function |
| ||
You have at your disposal any method of creating an illusion of movement you can think of, by drawing a series of images to the screen. The origin command can be used, sure, but it's a programming language, so - anything you can think of! |
| ||
The best way of drawing large images in my opinion is to use DrawImageRect. This way you only draw a portion of a larger bitmap onto the screen (there are known issues with off-screen drawing on older cards). Heres a demo... gw = GraphicsWidth() gh = GraphicsHeight() image = LoadImage("backdrop1.bmp") x_offset = 0 ; Stores the offset for drawing the image y_offset = 0 Repeat MoveCharacter DoCollisions ; Draw Image DrawImageRect 0, 0, x_offset, y_offset, gw, gh Until EndGame |
| ||
If you want a prime example, download this demo (40mb odd) of my game Dr Franken - its 8 way tile map based. |
| ||
Yes for larger bitmaps i think that drawimage rect is a good command indeed. For a tiled screen i think that the easiest method (easiest if you aren't confused with many object...) is the origin... In my old language (back in the amiga days)for the scrolling there's a specific command,i think it's called "scrollviewport" or something.... |
| ||
If you want a prime example, download this demo (40mb odd) of my game Dr Franken - its 8 way tile map based. And an absolutely terrific game may I add - although it's easy to get lost in those huge maps! |