Ok this problem is on the same program but it's a little different, i've been working on it and i'm trying to turn this into a game engin but i'm having trouble with displaying the enemy ships and there movement. I also know that i'ts loading the data correctly caus i checked that. Anyways here's the code if you need any of the files i can post them or whatever. Thanks guys.
`Game engin by CPU
`still in progress
sync on
hide mouse
disable escapekey
set display mode 800,600,16
ink rgb(255,255,255),0
`initalize some veribles
maxstars = 300
maxpatterns = 10
`read the level data
open to read 1,"Level1.txt"
read string 1,tmp$
maxobjects = val(tmp$) + 1
`load the patterns that the AI will use
open to read 2,"Patterns1.txt"
read string 2,tmp$
maxpatterns = val(tmp$)
`initalize some arays and veribles
dim starsX(maxstars)
dim starsY(maxstars)
dim starsZ(maxstars)
dim objectX(maxobjects)
dim objectY(maxobjects)
OldX = 0
OldY = 0
camY = 0
dim objectimage(maxobjects)
dim objectflag(maxobjects)
dim objectreload(maxobjects,2)
dim patterns(maxpatterns,1000,2)
dim objectpattern(maxobjects,2)
dim objectarmor(maxobjects)
dim blasts(50)
`load pattern data
for a = 1 to maxpatterns + 1
read string 2,tmp$
tmp2 = val(tmp$)
patterns(a,0,0) = tmp2
for b = 1 to tmp2 + 1
read string 2,tmp$
patterns(a,b,1) = val(tmp$)
read string 2,tmp$
patterns(a,b,2) = val(tmp$)
next b
next a
`load level data
for a = 1 to maxobjects
read string 1,tmp$
objectX(a) = val(tmp$)
read string 1,tmp$
objectY(a) = val(tmp$)
read string 1,tmp$
objectimage(a) = val(tmp$)
read string 1,tmp$
objectflag(a) = val(tmp$)
read string 1,tmp$
objectreload(a,0) = val(tmp$)
read string 1,tmp$
objectreload(a,1) = val(tmp$)
read string 1,tmp$
objectpattern(a,0) = val(tmp$)
objectpattern(a,1) = 0
objectpattern(a,2) = patterns(val(tmp$),0,0)
inc a
next a
close file 1
close file 2
`ititalize the stars
for a = 1 to maxstars
starsX(a) = rnd(800)
starsY(a) = rnd(600)
starsZ(a) = rnd(20)
repeat
starsZ(a) = rnd(20)
until starsZ(a) > 5
next a
`load immages
o
`begin main game loop
repeat
cls
`update star positions
for a = 1 to maxstars
starsY(a) = starsY(a) + starsZ(a)
if starsY(a) > 600
starsY(a) = 0
starsX(a) = rnd(800)
repeat
starsZ(a) = rnd(20)
until starsZ(a) > 5
endif
next a
`draw stars
for a = 1 to maxstars
ink rgb(starsZ(a) * 10 + 55,starsZ(a) * 10 + 55,starsZ(a) * 10 + 55),0
dot starsX(a),starsY(a)
next a
`update player positon
OldX = objectX(1)
OldY = objectY(1)
if upkey() = 1
objectY(1) = objectY(1) - 5
if objectY(1) < 0
objectY(1) = OldY
endif
endif
if downkey() = 1
objectY(1) = objectY(1) + 5
if objectY(1) > 536
objectY(1) = OldY
endif
endif
if rightkey() = 1
objectX(1) = objectX(1) + 5
if objectX(1) > 740
objectX(1) = OldX
endif
endif
if leftkey() = 1
objectX(1) = objectX(1) - 5
if objectX(1) < 0
objectX(1) = OldX
endif
endif
`update enemys
a = 1
repeat
`see if sprite is active
if mod(objectflag(a),2) = 0
sprite a,objectX(a),objectY(a),objectimage(a)
if objectflag(a) > 1
if objectpattern(a,1) > objectpattern(a,2)
`objectY(a) = 700
`hide sprite a
else
objectX(a) = patterns(objectpattern(a,0),objectpattern(a,1),1) + objectX(a)
objectY(a) = patterns(objectpattern(a,0),objectpattern(a,1),2) + objectY(a)
objectpattern(a,1) = objectpattern(a,1) + 1
objectreload(a,2) = objectreload(a,2) - 1
if objectreload(a,2) < 1
` FIRE STUFF
objectreload(a,2) = objectreload(a,1)
endif
endif
endif
else
`if sprite is unactive
if objectY(a) <= camY + 64
objectflag(a) = objectflag(a) - 1
objectY(a) = -64
endif
endif
inc a
until a = maxobjects
backdrop off
camY = camY + 1
sync
until escapekey() = 1
function mod(p,q)
r = p - (int(p/q) * q)
endfunction r
Sparring - Loved by many, Pefected by few.