For some reason i think im going to have to start my whole project over. Maybe there is something wrong with my approach. What i want to do is be able to scroll a hexagonal map. But keep the data stored so that i know exactly which hexes are being displayed (so later i can manipulate that data by clicking).
Here are the 2 different programs, neither one getting the desired effect.
sync on
sync rate 0
set display mode 1024,768,32
set image colorkey 0,0,0
set text transparent
load image "C:\Documents and Settings\JASON\Desktop\hex1.bmp",1
load image "C:\Documents and Settings\JASON\Desktop\hex2.bmp",2
set current bitmap 0
dim map(20,20)
dim view(10,10)
for i = 0 to 20
for j = 0 to 20
map(i,j) = rnd(1)+1
next j
next i
global viewx=0
global viewy=0
global xoffset=0
global yoffset=0
get_cells(viewx,viewy)
display()
do
if downkey() = 1
cls
yoffset = yoffset - 1
display()
endif
if upkey() = 1
cls
yoffset = yoffset + 1
display()
endif
if leftkey() = 1
cls
xoffset = xoffset + 1
display()
endif
if rightkey() = 1
cls
xoffset = xoffset - 1
display()
endif
sync
loop
function get_cells(x,y)
for i = 0 to 9
for j = 0 to 9
view(j,i) = map(x,y)
x=x+1
next j
y=y+1
next i
endfunction
function display()
for i = 0 to 9
for j = 0 to 9
paste image view(j,i),(j *80 + (i mod 2)*40)+xoffset, (i *60)+yoffset ,1
next j
next i
endfunction
and
sync on
sync rate 0
set display mode 1024,768,32
set image colorkey 0,0,0
set text transparent
load image "C:\Documents and Settings\JASON\Desktop\hex1.bmp",1
load image "C:\Documents and Settings\JASON\Desktop\hex2.bmp",2
randomize timer()
type cell
number as integer
xpos as integer
ypos as integer
row as integer
col as integer
terrain as integer
endtype
dim mapscreen(64) as cell
xTiles = 8
yTiles = 8
get_grid()
for i = 0 to 64
mapscreen(i).terrain = rnd(1)+1
next i
for i = 0 to 64
paste image mapscreen(i).terrain, mapscreen(i).xpos, mapscreen(i).ypos, 1
text mapscreen(i).xpos+20, mapscreen(i).ypos+20, str$(mapscreen(i).row)
text mapscreen(i).xpos+40, mapscreen(i).ypos+20, str$(mapscreen(i).col)
next i
do
sync
loop
function get_grid()
xTiles = 8
yTiles = 8
i = 0
for y = 0 to yTiles-1
for x = 0 to xTiles-1
inc i
mapscreen(i).number = i
mapscreen(i).xpos = x *80 + (y mod 2)*40
mapscreen(i).ypos = y *60
mapscreen(i).row = x
mapscreen(i).col = y
next x
next y
endfunction
80 X 80 bitmaps once again, that will eventually be changed to make better hexagons.
But you can see the different approaches. Im sure everyone can see what im trying to do here. Please help! thanks