Errrr, the dba file is of no use without media. There's 95% of the community at least here or more that won't be bothered stealing your code.
You could have just simple done this: (with a little added indentation)
Sowwy, but it didn't run as I don't have the media to test it and I was busy re-ka-jigging the formatting to read it.
scrw=1024
scrh=768
set display mode scrw,scrh,32
sync on
sync rate 60
backdrop on
color backdrop 0
pom1 = 4
speed = 32
Type Tile
img as integer
Endtype
Type SystemVariables
mapwidth as integer
mapheight as integer
viewWidth as integer
viewHeight as integer
size as integer
Endtype
Global System as SystemVariables
System.size = 128/pom1
restore Level1
System.mapWidth = 16*pom1
System.mapHeight = 16*pom1
System.viewWidth = screen width()/ System.size
System.viewHeight = screen height()/ System.size
Dim map( System.mapWidth , System.mapHeight) as Tile
set image colorkey 255,255,255
load image "img\tank1.bmp",11
load image "img\tank2.bmp",12
load image "img\projectile.bmp",13
load image "bgtile.png",2
load image "terrain1.png",1
restore level1
for x = 1 to System.mapWidth
for y = 1 to System.mapHeight
read map(x,y).img
next y
next x
pox#=int(scrw/2)
poy#=int(scrh/2)
vel#=1
DO
sprite 1,pox#,poy#,11
offset sprite 1,32,32
rotate sprite 1,pom
time=timer()
pox#=sprite x(1)
poy#=sprite y(1)
mx=mousex()-sprite x(1)
my=mousey()-sprite y(1)
ang2#=sprite angle(1)
ang#=atanfull(mx,-my)
sprite 2,sprite x(1),sprite y(1),12
offset sprite 2,32,36
set sprite priority 2,9
watch1=sprite x(2)
watch2=sprite y(2)
if spacekey()=1 then move sprite 1,100
rotate sprite 2,ang#
if mouseclick()=1 and unit=0
unit=1
x1#=mousex()
y1#=mousey()
unitselect=1
kat#=ang#
endif
if mouseclick()=2 and unit=0
counter=time
unit=1
order=1
x2#=mousex()
y2#=mousey()
kat2#=ang#
endif
if mouseclick()=0 then unit=0
if unitselect=1
if ang2#=-180 then ang2#=180
if ang2#=180 then ang2#=-180
if kat#-0.5<ang2# and ang2#<kat#+0.5
move sprite 1,2
else
rotate sprite 1,ang2#+1
pom=sprite angle(1)
endif
endif
if sprite x(1)>x1#-10 and sprite x(1)<x1#+10 and sprite y(1)>y1#-10 and sprite y(1)<y1#+10 then unitselect=0
set cursor 0,0
if mousex()>scrw-10 and x#<system.mapwidth*system.size-system.size*8*pom1
dec pox#,speed
dec x1#,speed
dec x2#,speed
inc x#,speed
endif
if mousex()<10 and x#>0
inc pox#,speed
inc x1#,speed
inc x2#,speed
dec x#,speed
endif
if mousey()<10 and y#>0
inc poy#,speed
inc y1#,speed
inc y2#,speed
dec y#,speed
endif
if mousey()>scrh-10 and y#<system.mapheight*system.size-system.size*6*pom1
dec poy#,speed
dec y1#,speed
dec y2#,speed
inc y#,speed
endif
drawMap(x#,y#)
sync
LOOP
Function drawMap(vx#, vy#)
sx = int(vx#/System.size)
sy = int(vy#/System.size)
ox = vx# mod System.size
oy = vy# mod System.size
for x = sx to sx+System.viewWidth+1
for y = sy to sy+System.viewHeight+1
img = getTileImage(x+1,y+1)
if img > 0
ix = (x - sx)*System.size
iy = (y - sy)*System.size
paste image img, ix, iy
endif
next y
next x
endfunction
function getTileImage(x, y)
if x => 0 and x <= System.mapWidth and y => 0 and y <= System.mapHeight
i = map(x,y).img
endif
endfunction i
And attached the media for those that needed it.
I tried reading through but it's late now... I'll re-check these posts tomorrow...
Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!