This is my first time experimenting with the DIM vars....after reading the begginers guide to darbasic...this is the code so far...
xpos = 250
ypos = 413
n=500
dim x(n,3)
lives = 3
ta = 1
sx = 1
sy = 10
DIM way(max) = 0
sh = 0
max = 15
an = 1
DIM spritex(max)
DIM spritey(max)
DIM spritenum(max)
`Set screen
SYNC RATE 60
set display mode 640,480,32
sync on
`Load things...
LOAD BITMAP "images/bc.bmp", 1
GET IMAGE 1, 0,0,79,70
LOAD BITMAP "images/laser2.bmp", 2
GET IMAGE 2,0,0,30,50
load bitmap "images/scourge.jpg",3
get image 3,0,0,29,39
load bitmap "images/main1.bmp",4
load bitmap "images/lose.jpg",5
load bitmap "images/exp1.bmp",6
get image 5,0,0,64,64
get image 6,64,0,128,64
get image 7,128,0,192,64
get image 8,192,0,256,64
get image 9,0,64,64,128
get image 10,64,64,128,128
get image 11,128,64,192,128
get image 12,192,64,256,128
get image 13,0,128,64,192
get image 14,64,128,128,192
get image 15,128,128,192,192
get image 16,192,128,256,192
get image 17,0,192,64,256
get image 18,64,192,128,256
get image 19,128,192,192,256
get image 20,192,192,256,256
load bitmap "images/life.bmp",7
get image 21,0,0,20,18
`Title
copy bitmap 4,0
WAIT KEY
SET CURRENT BITMAP 0
`Set up parallax stars pos and speed
for k=1 to n
x(k,1)=rnd(639)+1
x(k,2)=rnd(479)+ 1
x(k,3)=rnd(9)+1
next k
`Set up sprites
SPRITE 1,xpos,ypos,1
SPRITE 3,100,100,4
for i = 10 to max
spritex(i) = RND(380)
spritey(i) = 1
SPRITE i,spritex(i),spritey(i),3
next i
`Game Loop
DO
`Handler for stars...
cls 0
for i=1 to n
x(i,2)=x(i,2)+x(i,3)
if x(i,2)>=480
x(i,2)=1
x(i,1)=rnd(639)+1
endif
col=x(i,3)*30
ink rgb(col,col,col),1
dot x(i,1),x(i,2)
next i
`Detect if Scourge is hit, and makes explosion
if fire = 1
fh = sprite hit(2,3)
if fh = 1
ta=0
delete sprite 3
for i = 5 to 20
sprite i,sx-21,sy-24,i
sleep 50
delete sprite i
next i
ENDIF
ENDIF
`Determines how the scourge should act
for i = 10 to max
if way(i) = 0
if spritex(i) < 620 then spritex(i) = spritex(i) + 4
if spritex(i) >= 620 then way(i) = 1
endif
if way(i) = 1
spritex(i) = spritex(i) - 4
if spritex(i) <= 10 then way(i) = 0
endif
if spritex(i) = xpos then way(i) = 2
if way(i) = 2 Then spritey(i) = spritey(i) + 8
next i
`If BC is hit then...
sh = sprite hit(1,3)
if sh = 1
dec lives
delete sprite 3
ta = 0
for i = 5 to 20
sprite i,sx-21,sy-24,i
sleep 50
delete sprite i
next i
endif
`Handler for BC lives.
se = sprite exist(21)
see = sprite exist(22)
seee = sprite exist(23)
if lives = 3
sprite 21,610,0,21
sprite 22,590,0,21
sprite 23,570,0,21
endif
if lives = 2
if seee = 1 then delete sprite 23
sprite 21,610,0,21
sprite 22,590,0,21
endif
if lives = 1
if seee = 1 then delete sprite 23
if see = 1 then delete sprite 22
sprite 21,610,0,21
endif
if lives = 0
cls
copy bitmap 5,0
wait key
end
endif
`Set bitmap to 0
set current bitmap 0
`Input
IF leftkey() = 1 THEN xpos = xpos - 3
IF rightkey() = 1 THEN xpos = xpos + 3
IF upkey() = 1 THEN ypos = ypos -3
IF downkey() = 1 THEN ypos = ypos + 3
IF spacekey() = 1
if fire = 0
fxpos = xpos +34
fypos = ypos -55
fire = 1
ENDIF
ENDIF
`Move laser
IF fire = 1
fypos = fypos -12
ENDIF
`Limits the player so he cant go off the screen
if xpos > 560
xpos = 560
ENDIF
if xpos < 0
xpos = 0
ENDIF
if ypos < 0
ypos = 0
ENDIF
if ypos < 250
ypos = 250
ENDIF
IF ypos > 413
ypos = 413
ENDIF
`Update
if fire = 1
SPRITE 2,fxpos,fypos,2
ENDIF
if fypos < 0
DELETE SPRITE 2
fire = 0
ENDIF
if ta = 1
for i = 10 to max
sprite i,spritex(i),spritey(i),3
next i
endif
SPRITE 1, xpos,ypos, 1
SYNC
LOOP
Dark