Hi
Say I have a big world map that overlaps the device screen size how would I scroll the device screen around the big world map?
Is there a world coordinates and a local screen device coordinates?
Is there a way to fix sprites/text to the device screen, while it scrolls around the map?
Any example code would be helpful.
Thanks.
Scotty
Here's a quick example using a large bitmap image (not recommended in a scrolling game really, better to use a tile map system).
// Create a large virtual screen sprite that we will use as the scrolling background
CREATESCREEN 1,999,1000,1000
// Set all drawing to the virtual screen that we just created
USESCREEN 1
// Draw random rectangles on virtual screen
FOR n=0 TO 100
DRAWRECT RND(1000),RND(1000),RND(64),RND(64),RGB(RND(255),RND(255),RND(255))
NEXT
// All drawing operations revert back to normal screen
USESCREEN -1
// Scroll positions
GLOBAL scrollx, scrolly
// Repeat until ESC pressed
WHILE TRUE
// Scroll up
IF KEY(208) THEN DEC scrolly
// Scroll down
IF KEY(200) THEN INC scrolly
// Scroll left
IF KEY(203) THEN INC scrollx
// Scroll right
IF KEY(205) THEN DEC scrollx
// Draw background sprite
DRAWSPRITE 999,scrollx,scrolly
// Show text on the screen at normal position to prove the screen itself doesn't scroll
PRINT "HELLO",10,10
SHOWSCREEN
WEND
Hi Ian
Thanks for your reply. I will have to look for a tile map system tutorial.
Many thanks. :)
Scott.
howover bitmap graphics os possible, but its limited by its size. We diddent use tiles in Jungool example, but a bit map on a world level select screen is actuelly normal.
But for larger map of course, tiles is prefer.
Of course - using bitmaps or tilemaps will depend on various factors, including intended size, complexity of image, memory, storage space and speed of destination device etc. etc.
There are also other methods of drawing the bitmap to the screen too, including Viewports and POLYVECTORs.
There are said to be a 1001 ways to skin a cat. There are more ways to scroll a screen! :P