Moving a map

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

User avatar
lurah-
Veteran
Posts: 206
Joined: Mon Nov 01, 2004 10:47 am
Location: Finland
Contact:

Moving a map

Postby lurah- » Sat Dec 04, 2004 1:07 am

Ok, i have created a map on Screen 0:Width 80,50
After creating i want to save in on OldMap and colors are stored on OldMapC.

OldMap & OldMapC are dimmed and so on...

--- Code ---
SUB Readmap

FOR i = 1 TO 48
FOR i2 = 1 TO 78
OldMap(i, i2) = SCREEN(i, i2)
OldMapC(i, i2) = SCREEN(i, i2, 1)
NEXT
NEXT
--- End of code ---

Yeah, it?s in there now. I can read it from there.
Next ill try to draw 10*10 area of map.

--- Code ---
Sub DrawMap

FOR q = x - 5 TO x + 5
FOR w = y - 5 TO y + 5
COLOR OldMapC(q, w): LOCATE q, w: PRINT CHR$(OldMap(q, w))
NEXT
NEXT
--- End of code ---

Yeah, "LOCATE q,w: PRINT CHR..." prints right place from the map but it also draws it on the same place where it was when created.
I have tryed several ways to print that piece of map in same place (middle of screen) all times but havent figured out how. Propably the answer is easy as hell but now im stuck with it =)

[edit]
Ok, i figured it out my self.
[/edit]

Return to “QBASIC and QB64 Questions & Answers”

Who is online

Users browsing this forum: No registered users and 3 guests