hmmm, I don't really understand why you put every new level in a for next loop. Don't misunderstand me, you can use a for next loop as the main loop. I will take a look at your code and see what I can do about it
[EDIT]:
Just took a look at the code. You seem to do it a special way. You don't need to repeat all code just for swithing level
You can do that much easier. I may try to change some of the code. And fix the printing problem, I think I know why you can't get it to work.
[EDIT]:
Okay i've fixed the problem with printing the variable(highscore).
I don't really have any choice but to put it in the code snippets. Just copy it and read it in the IDE. Here it is:
rem set up stuff
sync on
hide mouse
rem NOT WORKING: load and play sound
rem load sound "bobfallblob.wav",1
rem play sound 1
rem splash
print "Bob and Falling Blobs"
main:
print "Type g to play. Type v to view the version. Type i to see the instructions. Type h for the high score."
input i$
rem main input
if i$ = "g" then goto gameloop
if i$ = "h" then goto highscore
if i$ = "i" then goto instruct
if i$ = "v"
goto vers
else
print "Error! Please retype."
goto main
endif
rem instructions
instruct:
print "Use the arrow keys to move the sphere at the bottom of the screen."
print "Try to avoid the other objects."
goto main
rem versions
vers:
cls
print "Bob and Falling Blobs"
print "Version: 1.1"
print "External Media: No"
print ""
wait 1000
goto main
rem show highscore
highscore:
open to read 1,"bafbhighscore.txt"
read file 1,highscore
close file 1
print highscore
wait 1000
goto main
rem main game
gameloop:
rem NOT WORKING: load textures
rem load bitmap "firstlvl.bmp",1
rem load bitmap "secondlvl.bmp",2
rem load bitmap "thirdlvl.bmp",3
rem load bitmap "forthlvl.bmp",4
rem load bitmap "you.bmp",5
rem set up player's sphere
make object sphere 1,50
position object 1,0,-1000,1000
objs = 2
objfirst = 2
set global collision on
rem main game loop
for li = 1 to 15
make object cube objs,60
position object objs,rnd(200)-100,400,1000
objs = objs + 1
for j = 1 to 26
for i = objfirst to objs-1
spherex = object position x(1)
if object position y(i) < -1010
delete object i
objfirst = objfirst + 1
cls
else
objx = object position x(i) + rnd(100)-50
objy = object position y(i) - 10
position object i,objx,objy,1000
endif
wait .1
if object hit(1,0)>0 then goto youlost
next i
inc currhighscore,5
set cursor 0,0
print currhighscore
if rightkey() = 1 then position object 1,spherex+15,-1000,1000
if leftkey() = 1 then position object 1,spherex-15,-1000,1000
next j
next li
for lii = 1 to 30
make object cube objs,60
position object objs,rnd(200)-100,400,1000
objs = objs + 1
for j = 1 to 26
for i = objfirst to objs-1
spherex = object position x(1)
if object position y(i) < -1010
delete object i
currhighscore = currhighscore + 5
objfirst = objfirst + 1
cls
else
objx = object position x(i) + rnd(100)-50
objy = object position y(i) - 10
position object i,objx,objy,1000
endif
wait .1
if object hit(1,0)>0 then goto youlost
next i
inc currhighscore,5
set cursor 0,0
print currhighscore
if rightkey() = 1 then position object 1,spherex+15,-1000,1000
if leftkey() = 1 then position object 1,spherex-15,-1000,1000
next j
next lii
for liii = 1 to 40
make object cube objs,60
position object objs,rnd(200)-100,400,1000
objs = objs + 1
for j = 1 to 26
for i = objfirst to objs-1
spherex = object position x(1)
if object position y(i) < -1010
delete object i
currhighscore = currhighscore + 5
objfirst = objfirst + 1
cls
else
objx = object position x(i) + rnd(100)-50
objy = object position y(i) - 10
position object i,objx,objy,1000
endif
wait .1
if object hit(1,0)>0 then goto youlost
next i
inc currhighscore,5
set cursor 0,0
print currhighscore
if rightkey() = 1 then position object 1,spherex+15,-1000,1000
if leftkey() = 1 then position object 1,spherex-15,-1000,1000
next j
next liii
for liv = 1 to 80
make object cube objs,60
position object objs,rnd(200)-100,400,1000
objs = objs + 1
for j = 1 to 26
for i = objfirst to objs-1
spherex = object position x(1)
if object position y(i) < -1010
delete object i
currhighscore = currhighscore + 5
objfirst = objfirst + 1
cls
else
objx = object position x(i) + rnd(100)-50
objy = object position y(i) - 10
position object i,objx,objy,1000
endif
wait .1
if object hit(1,0)>0 then goto youlost
next i
inc currhighscore,5
set cursor 0,0
print currhighscore
if rightkey() = 1 then position object 1,spherex+15,-1000,1000
if leftkey() = 1 then position object 1,spherex-15,-1000,1000
next j
next liv
print "Congratulations! You beat the game! That means that you dodged 1300 objects!"
youlost:
if file exist("bafbhighscore.txt")
open to read 1,"bafbhighscore.txt"
read file 1,highscore
close file 1
else
highscore = 0
endif
if highscore < currhighscore
if file exist("bafbhighscore.txt") then delete file "C:\media\bafbhighscore.txt"
open to write 2,"bafbhighscore.txt"
write file 2,currhighscore
close file 2
endif
delete sound 1
end
Now I know why you get the flickering screen when counting, the places where you print what level you're at and what your highscore is. You do that each time an object needs to be deleted. You can see where I have placed the code for the highscore now. Also you(as I said before) don't need to repeat everything when coming to a new level, your code could be much smaller than it is. I tried to change that, but I just can't do that
Your code is cryptic. But just so you know, changing level in a game like that, is just a matter of changing some numbers here and there
I will try to make a small game to demonstrate it.
-The Nerd
PanzerGames
here
Free Particle Engine For dbpro :
here