That's pretty good but I had to edit your code a bit so it didn't blink like crazy. You always have to use SYNC ON if you want to control the screen updates. If you don't use SYNC ON using SYNC doesn't matter because the screen automatically updates when anything is changed on the screen. I put the SYNC RATE at zero so it would SYNC as fast as the computer can handle it... use any number to cap the FPS at whatever number you want if it's too fast.
I put RANDOMIZE TIMER() at the top of your code because it's really only needed to be seen once (you put it inside a DO/LOOP where it does it over and over again).
The code must of been an older version because your array was too small for the amount of sprites you wanted. I remed off the SYNC OFF since you don't really want to stop controlling the screen updates once you start. And you really don't need all those variables GLOBAL since you aren't using any functions.
Here's your code modified:
Rem Project: angel
Rem Created: 7/3/2010 4:42:41 PM
Rem ***** Main Source File *****
` This is only needed once so it's fine right here
randomize timer()
` Sync the game as fast as the computer running it can handle
sync rate 0 ` Change the zero to any number if it's too fast
` Turn on syncing (without this "sync" is useless because it already updates the screen anytime something is drawn)
sync on
` First sync to make sure the loading screen can be seen
sync
`sprites
global BLOND_ANGEL_SPR = 1
global WASP_SPR = 3
global SCRATCH_ANGEL_SPR = 20
global SCRATCH_WASP_SPR = 21
global ARROW_SPR_ONE = 22
global ARROW_SPR_TWO = 23
global ARROW_SPR_THREE = 24
global SCORE_SPR = 25
global LIVES_SPR = 26
global LEVEL_SPR = 27
global LEVEL_UP_SPR = 28
global AURA_SPR = 29
global SCRATCH_AURA_SPR = 30
global GAME_OVER_SPR = 31
global PLAY_AGAIN_SPR = 32
`images
global BLOND_ANGEL_IMG = 1
global BACKGROUD = 2
global WASP_IMG = 3
global SCRATCH_ANGEL_IMG = 20
global SCRATCH_WASP_IMG = 21
global ARROW_IMG = 22
global SCORE_IMG = 23
global LIVES_IMG = 24
global LEVEL_IMG = 25
global LEVEL_UP_IMG = 28
global AURA_IMG = 29
global SCRATCH_AURA_IMG = 30
global GAME_OVER_IMG = 31
global PLAY_AGAIN_IMG = 32
`directions
global EAST = 1
global NORTH = 2
global SOUTH = 3
global WEST = 4
`variables
global new_direction = EAST
global blond_angel_direction = EAST
global blond_angel_start_frame = 1
global blond_angel_end_frame = 16
global blond_angel_x = 200
global blond_angel_y = 200
global background_x = 0
global blond_angel_speed = 3
global angel_hit_in = 0
global angle = 0
global index = 0
global k = 0
global show_question_in = 0
global game_over_in = 0
`sounds
global OH_NO_SOUND = 1
global BUZZING_SOUND = 2
global CHIME_SOUND = 3
global ARROW_SOUND = 4
global OUCH_SOUND = 5
global LEVEL_UP_SOUND = 6
global BEEP_SOUND = 7
global CORRECT_SOUND = 8
global WRONG_SOUND = 9
global time
global score
global level_score
global level = 1
global lives = 5
rem Loading screen
load bitmap "backdrop.jpg",1
copy bitmap 1,0,0,640,480,0,0,0,screen width(),screen height()
` Sync so the bitmap can be seen by the user
sync
delete bitmap 1
load sound "oh_no.wav", OH_NO_SOUND
load sound "mosquito_1.wav", BUZZING_SOUND
load sound "boing.wav", ARROW_SOUND
load sound "ouch.wav", OUCH_SOUND
load sound "levelup.wav", LEVEL_UP_SOUND
load sound "chime_up.wav", CHIME_SOUND
load sound "bicycle_bell.wav", BEEP_SOUND
load sound "ding.wav", CORRECT_SOUND
load sound "Buzzer.wav", WRONG_SOUND
load music "Rafael_Lukjanik_-_Modern_Classix_-_Popularna_klasyka-Lot_Trzmiela.mp3",1
set music volume 1, 1
loop music 1
`define the wasp structure
type wasp_t
x as integer
y as integer
speedx as integer
speedy as integer
hit_in as integer
endtype
` Wasp() was at 11 which caused an error... made it 20 instead.
dim wasp(20) as wasp_t
`define arrow structure
type arrow_t
x as integer
y as integer
visible_in as integer
endtype
dim arrow(3) as arrow_t
`define level_up structure
type level_up_t
x as integer
y as integer
speed as integer
ind as integer
endtype
level_up as level_up_t
level_up.speed = 1
level_up.x = screen width() / 2
` define aura type
type aura_t
x as integer
y as integer
speed as integer
ind as integer
endtype
aura as aura_t
`define question type
type question_t
querry as string
answer1 as string
answer2 as string
answer3 as string
correctanswer as string
endtype
open to read 1, "questions.txt"
while file end(1) = 0
read string 1, T$ : read string 1, T$ : read string 1, T$ : read string 1, T$ : read string 1, T$ : index = index + 1
endwhile
close file 1
dim questions(index) as question_t
open to read 1, "questions.txt"
while file end(1) = 0
i = i + 1
read string 1, T$ :questions(i).querry=T$
read string 1, T$ :questions(i).answer1=T$
read string 1, T$ :questions(i).answer2=T$
read string 1, T$ :questions(i).answer3=T$
read string 1, T$ :questions(i).correctanswer=T$
endwhile
close file 1
index = index - 1
load image "01_background.jpg", BACKGROUD
load image "scratchangel.bmp", SCRATCH_ANGEL_IMG
load image "scratchwasp.bmp", SCRATCH_WASP_IMG
load image "scratchaura.bmp", SCRATCH_AURA_IMG
load image "arrow.bmp", ARROW_IMG
load image "score.jpg", SCORE_IMG
load image "lives.jpg", LIVES_IMG
load image "level.jpg", LEVEL_IMG
load image "gameover.jpg", GAME_OVER_IMG
load image "playagain.jpg", PLAY_AGAIN_IMG
`sync off ` Don't really need this
draw sprites first
set text size 80
set image colorkey 85,183,255
create animated sprite BLOND_ANGEL_SPR, "angel.bmp", 16, 4, BLOND_ANGEL_IMG
create animated sprite WASP_SPR, "wasp.bmp", 8, 1, WASP_IMG
create animated sprite LEVEL_UP_SPR, "levelup.bmp", 4, 7, LEVEL_UP_IMG
create animated sprite AURA_SPR, "aura.bmp", 16, 1, AURA_SPR
set sprite frame BLOND_ANGEL_SPR, START_NORTH
set sprite priority BLOND_ANGEL_SPR, 1
set sprite priority WASP_SPR, 1
`set current bitmap 0
`make 10 more wasps and initialize them
for i = 4 to 14
clone sprite WASP_SPR, i
next i
for i = 3 to 14
wasp(i).x = rnd(screen width() - sprite width(3) ) + screen width() * 2
wasp(i).y = rnd(screen height())
wasp(i).speedx = rnd(4) + level - 1
wasp(i).speedy = rnd(4) + level - 1
next i
do
`randomize timer() ` This is copied at the top of the code... only need this once not per loop
if rnd(3000) = 1 and sound playing(BUZZING_SOUND) = 0 then play sound BUZZING_SOUND
if show_question_in = 0 and game_over_in = 0
if angel_hit_in = 0 ` if the angel has not been hit by a wasp let him move
if upkey()
new_direction = NORTH
blond_angel_y = blond_angel_y - blond_angel_speed
endif
if rightkey()
new_direction = EAST
blond_angel_x = blond_angel_x + blond_angel_speed
endif
if downkey()
new_direction = SOUTH
blond_angel_y = blond_angel_y + blond_angel_speed
endif
if leftkey()
new_direction = WEST
blond_angel_x = blond_angel_x - blond_angel_speed
endif
if spacekey() and timer() - time > 200
clear entry buffer
time = timer()
exit_in = 0
for i = 1 to 3
if arrow(i).visible_in = 0 and exit_in = 0
arrow(i).visible_in = 1
exit_in = 1
play sound ARROW_SOUND
endif
next i
endif
if blond_angel_direction <> new_direction
blond_angel_direction = new_direction
set sprite frame BLOND_ANGEL_SPR, 16 * blond_angel_direction - 15
endif
if blond_angel_y < 50 then blond_angel_y = 50
if blond_angel_x < -50 then blond_angel_x = -50
if blond_angel_y > screen height() - 80 then blond_angel_y = screen height() -80
if blond_angel_x > screen width() -80 then blond_angel_x = screen width() -80
else ` if the angel has been hit rotate him and set him off screen
blond_angel_y = blond_angel_y + 1
angle = angle + 1
rotate sprite BLOND_ANGEL_SPR, angle
` see it the angel fell off the screen if so reset everything
if blond_angel_y > screen height() + 80
rotate sprite BLOND_ANGEL_SPR, 0
blond_angel_x = 200
blond_angel_y = 200
angel_hit_in = 0
for i = 3 to 14
wasp(i).x = rnd(screen width() - sprite width(3) ) + screen width()
next i
endif
endif
endif
`update and draw the angel
sprite SCRATCH_ANGEL_SPR, blond_angel_x + 42, blond_angel_y +35, SCRATCH_ANGEL_IMG
hide sprite SCRATCH_ANGEL_SPR
play sprite BLOND_ANGEL_SPR, (16 * blond_angel_direction - 15), (16 * blond_angel_direction - 1) ,50
sprite BLOND_ANGEL_SPR, blond_angel_x, blond_angel_y,BLOND_ANGEL_IMG
`scroll the background
background_x = background_x -1
if background_x < -990 then background_x = 0
sprite BACKGROUD, background_x,0, BACKGROUD
`update and draw the wasps
for i = 3 to 14
play sprite i, 1, 7 ,50
if show_question_in = 0 and game_over_in = 0
if wasp(i).x <= screen width() * -1 or wasp(i).y >= screen height() - 50 or wasp(i).y < 50
wasp(i).hit_in = 0
wasp(i).x = rnd(screen width() - sprite width(3) ) + screen width()
wasp(i).y = rnd(screen height()) + 25
wasp(i).speedx = rnd(4) + level
wasp(i).speedy = 0
endif
wasp(i).x = wasp(i).x - wasp(i).speedx
if wasp(i).hit_in = 1 then wasp(i).speedy = wasp(i).speedx
wasp(i).y = wasp(i).y + wasp(i).speedy
sprite i, wasp(i).x, wasp(i).y, WASP_IMG
`check for collision of wasp and angel
sprite SCRATCH_WASP_SPR, wasp(i).x + 32, wasp(i).y +20, SCRATCH_WASP_IMG
hide sprite SCRATCH_WASP_SPR
if sprite collision (SCRATCH_WASP_SPR, SCRATCH_ANGEL_SPR) and angel_hit_in = 0 and wasp(i).hit_in = 0
angel_hit_in = 1
lives = lives - 1
play sound OH_NO_SOUND
endif
for j = 1 to 3
if sprite exist(21+j) ` Added this since it kept producing a sprite doesn't exist error
if arrow(j).visible_in = 1 and sprite collision (SCRATCH_WASP_SPR, 21 + J) and wasp(i).hit_in = 0
wasp(i).hit_in = 1
score = score + 10
level_score = level_score + 10
if sound playing(OUCH_SOUND) = 0 then play sound OUCH_SOUND
endif
endif
next j
endif
next i
`update arrows
for i = 1 to 3
if arrow(i).visible_in = 0
arrow(i).x = blond_angel_x + 70
arrow(i).y = blond_angel_y + 60
sprite 21 + i, arrow(i).x, arrow(i).y, ARROW_IMG
hide sprite 21 + i
else
arrow(i).x = arrow(i).x + 4
sprite 21 + i, arrow(i).x, arrow(i).y, ARROW_IMG
set sprite priority 21 + i, 1
show sprite 21 + i
if arrow(i).x > screen width() then arrow(i).visible_in = 0
endif
next i
`MENU
if level_score > 200
level = level + 1
level_up.ind = 1
level_score = 0
PLAY SOUND LEVEL_UP_SOUND
endif
sprite SCORE_SPR, 0, 0, SCORE_IMG
set sprite priority SCORE_SPR, 1
text sprite width(SCORE_SPR) + 5, 0 , str$(score)
sprite LEVEL_SPR, SCREEN WIDTH()/2 - 50 , 0, LEVEL_IMG
text SCREEN WIDTH()/2 - 50 + sprite width(LEVEL_SPR) + 5, 0 , str$(level)
sprite LIVES_SPR, SCREEN WIDTH() - SPRITE WIDTH(LEVEL_SPR) - 85 , 0, LIVES_IMG
text SCREEN WIDTH() - SPRITE WIDTH(LEVEL_SPR) - 85 + SPRITE WIDTH(LIVES_SPR) + 5, 0 , str$(lives)
` sync ` This sync isn't needed... two syncs a loop makes it blink
`display question
if show_question_in = 1
set text size 25
text 20, screen height()/2 -40, questions(k).querry
` text 300, screen height()/2 -40, str$(screen height()/2 -40)
` text 350, screen height()/2 -40, str$(mousey())
text 20, screen height()/2 - 20, questions(k).answer1
text 20, screen height()/2, questions(k).answer2
text 20, screen height()/2 + 20, questions(k).answer3
`text 400, 220, str$(index)
` text 400, 240, str$(k)
` text 400, 260, str$(screen height()/2 - 20)
`text 400, 280, str$(mousey())
if mousey() > (screen height()/2 - 20) and mousey() < (screen height()/2 - 20) + 10 and mouseclick() = 1
show_question_in = 0
hide mouse
set text size 80
if questions(k).correctanswer = "A"
play sound CORRECT_SOUND
score = score + 30
level_score = level_score + 30
for i = 3 to 14
wasp(i).hit_in = 1
next i
else
play sound WRONG_SOUND
endif
endif
if mousey() > (screen height()/2 ) and mousey() < (screen height()/2 ) + 10 and mouseclick() = 1
show_question_in = 0
hide mouse
set text size 80
if questions(k).correctanswer = "B"
play sound CORRECT_SOUND
score = score + 30
level_score = level_score + 30
for i = 3 to 14
wasp(i).hit_in = 1
next i
else
play sound WRONG_SOUND
endif
endif
if mousey() > (screen height()/2 + 20 ) and mousey() < (screen height()/2 + 20 ) + 12 and mouseclick() = 1
show_question_in = 0
hide mouse
set text size 80
if questions(k).correctanswer = "C"
play sound CORRECT_SOUND
score = score + 30
level_score = level_score + 30
for i = 3 to 14
wasp(i).hit_in = 1
next i
else
play sound WRONG_SOUND
endif
endif
show mouse
endif
` show level up icon
if level_up.ind = 1
play sprite LEVEL_UP_SPR, 1, 8, 50
sprite LEVEL_UP_SPR, level_up.x, level_up.y, LEVEL_UP_IMG
show sprite LEVEL_UP_SPR
set sprite priority LEVEL_UP_SPR, 1
if sprite frame (LEVEL_UP_SPR) = 8 then level_up.ind = 2
endif
if level_up.ind = 2
level_up.y = level_up.y - level_up.speed
play sprite LEVEL_UP_SPR, 13, 28, 50
sprite LEVEL_UP_SPR, level_up.x, level_up.y, LEVEL_UP_IMG
set sprite priority LEVEL_UP_SPR, 1
if level_up.y < 0 then level_up.ind = 0
endif
if level_up.ind = 0
level_up.y = screen height()
hide sprite LEVEL_UP_SPR
endif
if rnd(500) = 1 and aura.ind = 0 and show_question_in = 0 and game_over_in = 0
aura.ind = 1
aura.y = screen height()
aura.x = rnd (screen width())
aura.speed = 1
play sound CHIME_SOUND
endif
if aura.ind = 1
show sprite AURA_SPR
play sprite AURA_SPR, 1, 15, 50
aura.y = aura.y - aura.speed
sprite AURA_SPR, aura.x, aura.y, AURA_IMG
set sprite priority AURA_SPR, 1
sprite SCRATCH_AURA_SPR, aura.x + 10, aura.y + 10, SCRATCH_AURA_IMG
hide sprite SCRATCH_AURA_SPR
if sprite collision( SCRATCH_AURA_SPR, SCRATCH_ANGEL_SPR)
aura.ind = 0
hide sprite AURA_SPR
play sound BEEP_SOUND
k = rnd(index-1)+1
show_question_in = 1
endif
if aura.y < 0
aura.ind = 0
hide sprite AURA_SPR
endif
endif
sprite GAME_OVER_SPR, screen width()/2 - 200, screen height()/2 -100 ,GAME_OVER_IMG
set sprite priority GAME_OVER_SPR, 1
sprite PLAY_AGAIN_SPR, screen width()/2 - SPRITE WIDTH (GAME_OVER_SPR)/2, screen height()/2 + SPRITE HEIGHT(GAME_OVER_SPR) - 100 ,PLAY_AGAIN_IMG
set sprite priority PLAY_AGAIN_SPR, 1
if game_over_in = 0
hide sprite GAME_OVER_SPR : hide sprite PLAY_AGAIN_SPR
else
show sprite GAME_OVER_SPR : show sprite PLAY_AGAIN_SPR
show mouse
`text 400, 200, str$(mousex()) : text 400, 300, str$(mousey())
if mousey() > 330 and mousey() < 400
if mousex() > 340 and mousex() < 420 and mouseclick() = 1 then exit
if mousex() > 130 and mousex() < 240 and mouseclick() = 1
hide mouse
game_over_in = 0
score = 0
level = 1
level_score = 0
lives = 5
angel_hit_in = 1
blond_angel_y = screen height() + 100
endif
endif
endif
sync ` <- The only sync you need after the game starts
if lives < 1 then game_over_in = 1
loop
By the way I didn't see any spaghetti code since you didn't use GOTO so you're doing good.