i have a project due today and i can't get it to compile, please help.
sync on
sync rate 30
`---------------------------
`settings
`---------------------------
Block_size = 16 `pixels
Map_size = 128
`---------------------------
X = map_size
Y = map_size
Dim Map(X,Y,1) as string
loadmap("Media\Map.map" , Map_size)
type entity
X as integer
Y as integer
facing as integer
endtype
type Question
Question_Text as string
Awnser1 as string
awnser2 as string
awnser3 as string
awnser4 as string
correct_awnser as integer
endtype
global dim Questions(6) as Question
`load_questions()
player as entity
goto _find_Spawn
player.X = spawnX
player.Y = spawnY
ScreenX = screen width()
screenY = screen height()
num_of_blocksX = ScreenX / block_size
num_of_blocksY = ScreenY / block_size
load image "Media\door open.jpg",0
load image "Media\door closed.jpg",1
load image "Media\floor.jpg",2
load image "Media\walls.jpg",3
load image "Media\player.bmp",4
goto _main_menu
_game_loop:
do
topleftX = player.X - (num_of_blocksX/2)
topleftY = player.Y - (num_of_blocksY/2)
counterX = topleftX
counterY = topleftY
for RenderY = 1 to num_of_blocksY
for RenderX = 1 to num_of_blocksX
select map(counterX,counterY,0)
case "#"
paste image 3, RenderX*block_size,RenderY*block_size
endcase
endselect
next
next
sync
loop
return
`===========================================
`main menu
`===========================================
_main_menu:
load image "media\Welsh hunt Main Menu.png",6 `main menu background
selecteditem=1
do
`-------------------------------------------
`Render screen image
`-------------------------------------------
blue=RGB(0,128,255)
white=RGB(255,255,255)
`paste background image
paste image 6,0,0
`calculate line position
line_height=screen height()*0.8
line_start=screen width()*0.6
`draw line
ink white,0
line line_start,line_height,screen width(),line_height
`add title
set text size 50
text 40, 40, "Welsh Hunt"
`add menu items
set text size 12
if game_mode=1
button1_text$="Resume"
else
button1_text$="Start"
endif
if selectedItem=1 then ink blue,0 else ink white,0
text line_start+20,line_height-20,button1_text$
if selectedItem=2 then ink blue,0 else ink white,0
text line_start+100,line_height-20,"Intructions"
if selectedItem=3 then ink blue,0 else ink white,0
text line_start+20,line_height+10,"Options"
if selectedItem=4 then ink blue,0 else ink white,0
text line_start+100,line_height+10,"Quit"
`--------------------------------------------
`controls
`-------------------------------------------
if leftkey()=1 and hold=0
dec selecteditem,1
hold=1
endif
if rightkey()=1 and hold=0
inc selecteditem,1
hold=1
endif
if leftkey()=0 and rightkey()=0 and leftkey()=0 and rightkey()=0 and returnkey()=0 and escapekey()=0 then hold=0
if selecteditem<=0 then selecteditem=4
if selecteditem>=5 then selecteditem=1
SYNC
`--------------------------------------------
`selection code
`--------------------------------------------
`start
if returnkey()=1 and selecteditem=1 and hold=0
hold=4
game_mode = 1
gosub _game_loop
endif
if escapekey()=1 and hold=0
hold=4
game_mode = 1
gosub _game_loop
endif
`instructions
if returnkey()=1 and selecteditem=2 and hold=0
hold=1
gosub _instructions
endif
`options
if returnkey()=1 and selecteditem=3 and hold=0
hold=1
gosub _options_menu
endif
`quit
if returnkey()=1 and selecteditem=4 and hold=0
end
hold=1
endif
loop
return
`==================================================
`Options menu
`==================================================
_options_menu:
selecteditem=1
do
`-------------------------------------------
`Render screen image
`-------------------------------------------
blue=RGB(0,128,255)
white=RGB(255,255,255)
`paste background image
paste image 6,0,0
`add menu items
set text size 12
text_X=screen width()*0.3
if selectedItem=1 then ink blue,0 else ink white,0
text text_X,100,"Controls"
if selectedItem=2 then ink blue,0 else ink white,0
text text_X,120,"Graphics"
if selectedItem=3 then ink blue,0 else ink white,0
text text_X,140,"Sounds"
if selectedItem=4 then ink blue,0 else ink white,0
text text_X,160,"Back"
`--------------------------------------------
`controls
`-------------------------------------------
if upkey()=1 and hold=0
dec selecteditem,1
hold=1
endif
if downkey()=1 and hold=0
inc selecteditem,1
hold=1
endif
if upkey()=0 and downkey()=0 and returnkey()=0 then hold=0
if selecteditem=0 then selecteditem=4
if selecteditem=5 then selecteditem=1
SYNC
`--------------------------------------------
`selection code
`--------------------------------------------
`Controls
if returnkey()=1 and selecteditem=1 and hold=0
hold=1
endif
`Graphics
if returnkey()=1 and selecteditem=2 and hold=0
hold=1
endif
`Sounds
if returnkey()=1 and selecteditem=3 and hold=0
hold=1
endif
`back
if returnkey()=1 and selecteditem=4 and hold=0
hold=1
gosub _main_menu
endif
loop
return
`============================================
`Instructions
`============================================
_instructions:
do
paste image 6,0,0
sync
`--------------------------------------------
`selection code
`--------------------------------------------
if returnkey()=0 then hold=0
if returnkey()=1 and hold=0
hold=1
gosub _main_menu
endif
loop
return
`==================================================
`function: LOADMAP
`==================================================
function loadmap(filename$,size)
`map index
`. = nothing
`# = wall
`D = door
`: = floor
`U = spawn
`O = end
`S = Secret
`N = npc
open to read 1,filename$
for X=1 to size
for Y=1 to size
read byte 1,tmp
map(X,Y,0) = chr$(tmp)
next x
next z
close file 1
endfunction
`=====================================
_find_Spawn:
`=====================================
for X=1 to map_size
for Y=1 to map_size
if map(X,Y) ="O"
spawnY=Y
spawnX=x
endif
next x
next Y
return
`========================================
function Position_Sprite(ID,X,Y,angle)
`========================================
select angle
case 0
rotate sprite ID,0
paste sprite ID,X,Y
endcase
case 90
rotate sprite ID,90
paste sprite ID,X+block_size,Y
endcase
case 180
rotate sprite ID,180
paste sprite ID,X+block_size,Y+block_size
endcase
case 270
rotate sprite ID,270
paste sprite ID,X,Y+block_size
endcase
endselect
endfunction
`==============================================
_Ask_Question:
`==============================================
correct_awnser_selected = 0
question_number=rnd(0)+1 `find random number between 0 and 9 then add 1
do
ink RGB(180,180,180),0
box (screen width()/4)*1,(screen height()/4)*1,(screen width()/4)*3,(screen height()/4)*2.5
`display question text
ink white,0
text (screen width()/4)*1.1,(screen height()/4)*1,questions(question_number).question_text
`awnsers
if selectedItem=1 then ink blue,0 else ink white,0
text (screen width()/4)*1.1,(screen height()/4)*2,questions(question_number).Awnser1
if selectedItem=2 then ink blue,0 else ink white,0
text (screen width()/4)*1.6,(screen height()/4)*2,questions(question_number).Awnser2
if selectedItem=3 then ink blue,0 else ink white,0
text (screen width()/4)*2.1,(screen height()/4)*2,questions(question_number).Awnser3
if selectedItem=4 then ink blue,0 else ink white,0
text (screen width()/4)*2.6,(screen height()/4)*2,questions(question_number).Awnser4
`controls
if leftkey()=1 and hold=0 `left key
dec selecteditem,1
hold=1
endif
if rightkey()=1 and hold=0 `right key
inc selecteditem,1
hold=1
endif
if returnkey()=1 and hold=0 `enter key
hold=1
if selecteditem = questions(question_number).correct_awnser
for tick_timer=1 to 40 `correct message
`background
ink RGB(180,180,180),0
box (screen width()/4)*1,(screen height()/4)*1,(screen width()/4)*3,(screen height()/4)*2.5
`text
ink white,0
text (screen width()/4)*2,(screen height()/4)*1,"correct"
sync
next
correct_awnser_selected = 1
exit
else
for tick_timer=1 to 40 `incorrect message
`background
ink RGB(180,180,180),0
box (screen width()/4)*1,(screen height()/4)*1,(screen width()/4)*3,(screen height()/4)*2.5
`text
ink white,0
text (screen width()/4)*2,(screen height()/4)*1,"incorrect"
sync
next
endif
endif
if escapekey()=1 and hold = 0
hold = 10
gosub _game_loop
endif
if leftkey()=0 and rightkey()=0 and returnkey()=0 then hold=0
if selecteditem=0 then selecteditem=4
if selecteditem=5 then selecteditem=1
sync
loop
return
`==============================================
function Load_questions
`==============================================
remstart
type Question
Question_Text
Awnser1
awnser2
awnser3
awnser4
correct_awnser
endtype
remend
questions(1).Question_Text = "test question, awnser is 3"
questions(1).Awnser1 = "test 1"
questions(1).Awnser2 = "test 2"
questions(1).Awnser3 = "test 3"
questions(1).Awnser4 = "test 4"
questions(1).correct_awnser = 3
questions(2).Question_Text = ""
questions(2).Awnser1 = ""
questions(2).Awnser2 = ""
questions(2).Awnser3 = ""
questions(2).Awnser4 = ""
questions(2).correct_awnser = 0
questions(3).Question_Text = ""
questions(3).Awnser1 = ""
questions(3).Awnser2 = ""
questions(3).Awnser3 = ""
questions(3).Awnser4 = ""
questions(3).correct_awnser = 0
questions(4).Question_Text = ""
questions(4).Awnser1 = ""
questions(4).Awnser2 = ""
questions(4).Awnser3 = ""
questions(4).Awnser4 = ""
questions(4).correct_awnser = 0
questions(5).Question_Text = ""
questions(5).Awnser1 = ""
questions(5).Awnser2 = ""
questions(5).Awnser3 = ""
questions(5).Awnser4 = ""
questions(5).correct_awnser = 0
questions(6).Question_Text = ""
questions(6).Awnser1 = ""
questions(6).Awnser2 = ""
questions(6).Awnser3 = ""
questions(6).Awnser4 = ""
questions(6).correct_awnser = 0
endfunction
`==============================================
_interact:
`==============================================
select player.facing
case 0
temp_X = player.X
temp_Y = player.Y - 1
endcase
case 90
temp_X = player.X + 1
temp_Y = player.Y
endcase
case 180
temp_X = player.X
temp_Y = player.Y + 1
endcase
case 270
temp_X = player.X - 1
temp_Y = player.Y
endcase
endselect
if map(temp_X,temp_Y) = "D"
gosub _ask_question
if correct_awnser_selected = 1
if map(temp_X,temp_Y,1) = "1"
map(temp_X,temp_Y,1) = "0"
else
map(temp_X,temp_Y,1) = "1"
endif
endif
endif
return