thanks guys i re-re-did my code and it now works , am now inteh process of getting the quality of images and audio in, and bug fixes.
` all program variables
` setup variables
username$="admin"
password$="admin"
temp$=console_input$
temp=0
` this sets up the sesolution
mainresx=800
mainresy=600
cdepth=32
` console variables
console$="off"
consolemarker=0
console_input$=""
consoleprompt$=" _>"
interface$="root"
argument$=""
element$=""
PreviousArgument$=""
img_panel=100
spr_panelx=800
spr_panely=100
spr_panel=101
panel_expansion=10
` Main variables
hero=1
enemy=1
enemyx=40
enemyy=40
herox=400
heroy=300
imgnum=1
footstep=0
ducking=0
jumping=0
anim=0
gforce=5
score=0
herojump=4
jumpheight=0
maxjump$=""
landed=0
spacekey$=""
downkeyval=10
windowcompensation=20
aswespeak=timer()
moveplayerdistancer=5
moveplayerdistancel=5
` enemy variables
enemy1=40
enemy1x=700
enemy1y=400
` make level sprite number
levelmoveflagr=0
levelmoveflagl=0
levelmedium=60
levelsmall=30
levellong=100
leveldepthmedium=15
leveldepthsmall=5
leveldepthlong=25
level0=100
level0x=103
level1=101
level1x=154
level2=102
level2x=145
level3=103
level3x=24
level4=104
level4x=455
level5=105
level5x=358
level6=106
level6x=419
level7=107
level7x=686
level8=108
level8x=923
level9=109
level9x=860
level10=120
level10x=884
level11=121
level11x=1100
level12=122
level12x=11285
level13=123
level13x=1441
level14=124
level1x4=1441
level15=125
level15x=1584
` make then charms
charm1collected=0
charm2collected=0
charmbar=50
charanim=1
charmanimspeed=1
charmnum=26
charm1=51
charm1x=183
charm1y=259
charm2=52
charm2x=454
charm2y=521
` make the scene/background
scene1=23
scene1x=0
scene1y=0
scene2=24
scene2x=800
scene2y=0
scene3=25
scene3x=-799
scene3y=0
` player health
healthme=2
healthmex=64
healthmey=45
` for user name and health
healthmey_offset=7
healthmelevel=100
` player time
timeme=3
timemex=637
timemey=45
timemelevel=100
` hud
crownl=32
crownr=33
head=31
headx=25
heady=15
` menu variables
opt_x=240
opt_0_y=14
opt_1_y=123
opt_2_y=225
opt_3_y=372
menu_opt=1
menu_glow_alpha=0
menu_glow_alpha_rate=10
` loader variables
loaderx = 256
loadery = 64
` loader progress variables
loaded=0
progress=7
loading$=""
set display mode mainresx,mainresy,cdepth
set window on
set image colorkey 252,4,244
backdrop off
` Set the sync rate and turn syncing on (so it only SYNCs when you want it to)
sync rate 30
sync on
`###############################################################
` Load images
load image "sprites\stand.bmp",1
load image "sprites\stand.bmp",2
load image "sprites\trans.bmp",3
load image "sprites\trans.bmp",4
load image "sprites\walk.bmp",5
load image "sprites\walk.bmp",6
load image "sprites\walk.bmp",7
load image "sprites\walk.bmp",8
load image "sprites\duck.bmp",9
load image "sprites\trans_1.bmp",10
load image "sprites\jump.bmp",11
` Load Images for basic level
load image "levels\collider.bmp",20
load image "levels\collider.bmp",21
rem load image "levels\",22
` load scenes
load image "levels\scene1.bmp",23
load image "levels\scene2.bmp",24
load image "levels\scene3.bmp",25
` load images for charm sprite
load image "sprites\charm1.bmp",26
load image "sprites\charm2.bmp",27
load image "sprites\charm3.bmp",28
load image "sprites\charm4.bmp",29
load image "sprites\charmbar.bmp",30
` load hud
load image "sprites\head.bmp",31
load image "sprites\head(shell)l.bmp",32
load image "sprites\head(shell)r.bmp",33
` laod enemy sprites
load image "sprites\enemy(eye).bmp",40
` laod splash
load image "sprites\splash.bmp",99
` LOAD IMAGES FOR MENU
load image "sprites\NEWGAME.bmp",50
load image "sprites\NEWGAMESHADOW.bmp",51
load image "sprites\LOADGAME.bmp",52
load image "sprites\LOADGAMESHADOW.bmp",53
load image "sprites\OPTIONS.bmp",54
load image "sprites\GAMEOPTIONSSHADOW.bmp",55
load image "sprites\EXIT.bmp",56
load image "sprites\EXITSHADOW.bmp",57
` load console panel
load image "sprites\console\panel.bmp",100
`set teh console bg as a sprite
sprite spr_panel,spr_panelx,spr_panely,img_panel
` loader image
load image "sprites\loader.bmp",60
load image "sprites\loadercontainer.bmp",61
` sprite loaders for loading
rem sprite 60,loaderx,loadery,60
rem sprite 61,loaderx,loadery,61
` begin loop
sub_STARTLOOP:
do
` TURN MENU INTO SPRITES
sprite 50,opt_x,opt_0_y,50
size sprite 50,320,128
set sprite priority 50,1
sprite 51,opt_x,opt_0_y,51
size sprite 51,320,128
set sprite priority 51,2
sprite 52,opt_x,opt_1_y,52
size sprite 52,320,128
set sprite priority 52,3
sprite 53,opt_x,opt_1_y,53
size sprite 53,320,128
set sprite priority 53,4
sprite 54,opt_x,opt_2_y,54
size sprite 54,320,128
set sprite priority 54,5
sprite 55,opt_x,opt_2_y,55
size sprite 55,320,128
set sprite priority 55,6
sprite 56,opt_x,opt_3_y,56
size sprite 56,320,128
set sprite priority 56,7
sprite 57,opt_x,opt_3_y,57
size sprite 57,320,128
set sprite priority 57,8
if upkey()=1
if menu_opt > 1
menu_opt=menu_opt-1
endif
endif
if downkey()=1
if menu_opt < 4
menu_opt=menu_opt+1
endif
endif
if menu_glow=1
menu_glow_alpha=menu_glow_alpha+menu_glow_alpha_rate
endif
if menu_glow_alpha=150 then menu_glow=2
if menu_glow=2
menu_glow_alpha=menu_glow_alpha-menu_glow_alpha_rate
endif
if menu_glow_alpha=0 then menu_glow=1
if menu_opt=1
set sprite alpha 51,menu_glow_alpha
else
set sprite alpha 51,0
endif
if menu_opt=2
set sprite alpha 53,menu_glow_alpha
else
set sprite alpha 53,0
endif
if menu_opt=3
set sprite alpha 55,menu_glow_alpha
else
set sprite alpha 55,0
endif
if menu_opt=4
set sprite alpha 57,menu_glow_alpha
else
set sprite alpha 57,0
endif
if mousex() > 240 and mousex() < 560
if mousey() > 14 and mousey() < 123
if mouseclick() = 1
menu_opt = 1
endif
if mouseclick() = 2
if mouseclick() = 2
opt_x=mousex()
opt_0_y=mousey()
endif
endif
endif
if mousey() > 123 and mousey() < 225
if mouseclick() = 1
menu_opt = 2
endif
endif
if mousey() > 225 and mousey() < 372
if mouseclick() = 1
menu_opt = 3
endif
endif
if mousey() > 372 and mousey() < 600
if mouseclick() = 1
menu_opt = 4
endif
endif
endif
paste image 99,0,0
remstart
text 325,151,"MISSION UPDATE: "
text 261,176,"- collect all charms within the time frame"
text 261,227,"- escape the creatures lurking about"
text 261,282,"- proceed to the exit"
text 325,333,"HIT ENTER TO CONTINUE..."
remend
if returnkey()=1
delete sprite 50
delete sprite 51
delete sprite 52
delete sprite 53
delete sprite 54
delete sprite 55
delete sprite 56
delete sprite 57
exit
endif
sync
loop
set text size 18
` main game loop
sub_MAINLOOP:
do
paste image scene1,scene1x,scene1y
paste image scene2,scene2x,scene2y
paste image scene3,scene3x,scene3y
` for the bg to loop
if scene1x < -800
scene1x = 1600
endif
if scene2x < -800
scene2x = 1600
endif
if scene3x < -800
scene3x = 1600
endif
if scene1x > 2400
scene1x = -800
endif
if scene2x > 2400
scene2x = -800
endif
if scene3x > 2400
scene3x = -800
endif
` Show the player
sprite hero,herox,heroy,imgnum
size sprite hero,24,48
set sprite hero,1,1
` keeping player with in screen dimensions
if sprite x(hero)<1
herox=1
endif
if sprite x(hero)>mainresx-windowcompensation
herox=mainresx-windowcompensation
endif
if sprite y(hero)<1
heroy=1
endif
if sprite y(hero)>mainresy-windowcompensation
heroy=mainresy-windowcompensation
endif
` making a ceiling
if sprite y(hero)<=100
herojump=0
else
herojump=10
endif
` show the enemy
sprite enemy1,enemy1x,enemy1y,40
size sprite enemy1,32,32
` all the following are apart of the hud
` player name
text healthmex+healthmelevel,healthmey-healthmey_offset,username$
` player health
text healthmex+healthmelevel,healthmey+healthmey_offset,str$(healthmelevel)
sprite healthme,healthmex,healthmey,20
size sprite healthme,healthmelevel,19
set sprite priority healthme,2
` player timer
text timemex-timemelevel,timemey,str$(timemelevel)
sprite timeme,timemex,timemey,20
size sprite timeme,timemelevel,19
set sprite priority timeme,2
`laod player head and hud
sprite head,headx,heady,31
size sprite head,32,32
sprite crownl,0,0,32
size sprite crownl,64,64
sprite crownr,736,0,33
size sprite crownr,64,64
` hud ends here
` charm bar sprite
sprite charmbar,0,0,30
` animate charms
if charanim=1
charmnum=charmnum+charmanimspeed
if charmnum>29 then charmnum=26
endif
if sprite y(hero)>500
healthmelevel=healthmelevel-1
if healthmelevel=1 then healthmelevel=100
endif
rem ## delete me asap ##
platform=sprite collision(hero,0)
rem ####################
` sprite level colision
` make sure that the sprite doesnt overlap the other sprites
if sprite hit(hero,platform)=1
` so the player cant phase through a platform
if sprite y(hero)<sprite y(platform)
falling=0
HowTall=sprite height(hero)
NoOverlap=sprite y(platform)
OnLand=NoOverlap-HowTall
heroy=onland
downkeyval=0
else
downkeyval=10
endif
if sprite y(platform) < sprite y(hero)
heroy=sprite y(platform) + sprite height(platform)
specekey$="off"
herojump=0
else
herojump=9
endif
endif
` Check if he needs to animate (left to right)
if anim=1
imgnum=imgnum+1
if imgnum > 7 then imgnum=1
else
if anim=0 then imgnum=1
endif
` Check if he needs to animate (jump and duck)
if jumping=1
imgnum=10
imgnum=imgnum + 1
if imgnum > 11 then imgnum=11
else
if anim=0 then imgnum=1
endif
if ducking=1
imgnum=9
else
if anim=0 then imgnum=1
endif
` Check for the right arrow key
if rightkey() = 1
herox = herox + moveplayerdistancer
footstep = 1
if fright = 1
mirror sprite hero
fright = 0
endif
anim = 1
` will move the background with the hero
if sprite x(hero)>500
scene1x=scene1x-5
scene2x=scene2x-5
scene3x=scene3x-5
paste image scene1,scene1x,scene1y
paste image scene2,scene2x,scene2y
paste image scene3,scene3x,scene3y
` will move the level according to the hero
levelmoveflagr=1
endif
` will keep player from touching to border
if sprite x(hero)>468
moveplayerdistancer=3
endif
if sprite x(hero)>544
moveplayerdistancer=1
endif
if sprite x(hero)>618
moveplayerdistancer=0
endif
else
moveplayerdistancer=5
footstep = 0
endif
` Check for the left arrow key
if leftkey() = 1
herox = herox - moveplayerdistancel
footstep = 1
if fright = 0
mirror sprite hero
fright = 1
endif
anim = 1
` will move the background with the hero
if sprite x(hero)<200
scene1x=scene1x+5
scene2x=scene2x+5
scene3x=scene3x+5
paste image scene1,scene1x,scene1y
paste image scene2,scene2x,scene3y
paste image scene3,scene3x,scene3y
` will move the level according to the hero
levelmoveflagl=1
endif
` will keep player from touching to border
if sprite x(hero)<150
moveplayerdistancell=3
endif
if sprite x(hero)<110
moveplayerdistancel=1
endif
if sprite x(hero)<67
moveplayerdistancel=0
endif
else
moveplayerdistancel=5
footstep = 0
endif
remstart
` only goes up or down based on if its not touching anything
if sprite x(hero)-sprite height(hero)=sprite x(platform)
` Check for the down arrow key when touching a platform
if downkey() = 1
ducking = 1
else
ducking = 0
endif
endif
remend
` Check for the down arrow key
if downkey() = 1
heroy = heroy + downkeyval
ducking = 1
else
ducking = 0
endif
` maxjump height
if jumpheight<=70
` Check for the up arrow key
if spacekey$ = "on"
heroy = heroy - herojump
jumpheight=jumpheight + herojump
jumping = 1
falling = 0
else
jumping = 0
falling = 1
endif
` reach max jump height
if jumpheight>70
spacekey$="off"
else
spacekey$=""
endif
` check for space key
if spacekey()=1 and jumpheight<70
spacekey$="on"
else
spacekey$="off"
endif
if jumpheight=70
maxjump$="on"
endif
if jumpheight=0
maxjump$="off"
endif
if maxjump$="on"
for jumpheight=70 to 0
spacekey$="off"
next jumpheight
endif
endif
if jumpheight >= 70
if spacekey()=0
jumpheight=0
endif
endif
rem herojump=0:else:herojump=10
` reseting the animation flag
if scancode()<1
anim=0
endif
` simple gravity
if platform=0
if falling=1
remstart
for heroy=sprite y(hero) to 0
gforce = grorce + 1 / 5
heroy = heroy + gforce
next heroy
remend
gforce = gforce / 5
for gforce=1 to 5
heroy = heroy + gforce
next gforce
else
falling=0
gforce=0
endif
endif
` reset player
if inkey$()="r" or inkey$()="R"
herox=10
heroy=10
endif
` basic level
gosub level1
rem gosub debuginfo
gosub enemyai
` brings up the console
gosub hook_for_console_interupt
` Update the screen
sync
loop
return
Rem ***** Included Source File *****
level1enemy:
` show the enemy
sprite enemy1,enemy1x,enemy1y,40
size sprite enemy1,32,32
return
level1:
charm2collected=0
` make platform and show the charms
if rightkey()=1 and sprite x(hero)>500
if levelmoveflagr=1
level0x=level0x-5
level1x=level1x-5
level2x=level2x-5
level3x=level3x-5
level4x=level4x-5
level5x=level5x-5
level6x=level6x-5
level7x=level7x-5
level8x=level8x-5
level9x=level9x-5
level10x=level10x-5
level11x=level11x-5
level12x=level12x-5
level13x=level13x-5
level14x=level14x-5
level15x=level15x-5
enemy1x=enemy1x-5
if charm1collected=0
charm1x=charm1x-5
endif
if charm2collected=0
charm2x=charm2x-5
endif
endif
endif
if leftkey()=1 and sprite x(hero)<200
if levelmoveflagl=1
level0x=level0x+5
level1x=level1x+5
level2x=level2x+5
level3x=level3x+5
level4x=level4x+5
level5x=level5x+5
level6x=level6x+5
level7x=level7x+5
level8x=level8x+5
level9x=level9x+5
level10x=level10x+5
level11x=level11x+5
level12x=level12x+5
level13x=level13x+5
level14x=level14x+5
level15x=level15x+5
enemy1x=enemy1x+5
if charm1collected=0
charm1x=charm1x+5
endif
if charm2collected=0
charm2x=charm2x+5
endif
endif
endif
sprite level0,level0x,225,21
size sprite level0,levellong,leveldepthsmall
sprite level1,level1x,299,21
size sprite level1,levelmedium,leveldepthlong
sprite charm1,charm1x,charm1y,charmnum
size sprite charm1,32,32
set sprite alpha charm1,254
sprite level2,level2x,436,21
size sprite level2,levelsmall,leveldepthsmall
sprite level3,level3x,535,21
size sprite level3,levellong,leveldepthlong
sprite level4,level4x,109,21
size sprite level4,levelmedium,leveldepthlong
sprite level5,level5x,346,21
size sprite level5,levellong,leveldepthlong
sprite level6,level6x,566,21
size sprite level6,levelmedium,leveldepthlong
sprite charm2,charm2x,charm2y,charmnum
size sprite charm2,32,32
set sprite alpha charm1,254
sprite level7,level7x,369,21
size sprite level7,levelmedium,leveldepthmedium
sprite level8,level8x,178,21
size sprite level8,levelmedium,leveldepthmedium
sprite level9,level9x,333,21
size sprite level9,levelmedium,leveldepthmedium
sprite level10,level10x,528,21
size sprite level10,levelmedium,leveldepthmedium
sprite level11,level11x,283,21
size sprite level11,levelmedium,leveldepthmedium
sprite level12,level12x,514,21
size sprite level12,levelmedium,leveldepthmedium
sprite level13,level13x,155,21
size sprite level13,levelmedium,leveldepthmedium
sprite level14,level14x,75,21
size sprite level14,10,100
sprite level15,level15x,75,21
size sprite level15,100,10
` hide charm when collision occurs
if sprite collision(hero,charm1)=1
charm1collected=1
healthmelevel=healthmelevel+25
score=score+10
charm1x=120
charm1y=0
endif
if sprite collision(hero,charm2)=1
charm2collected=1
healthmelevel=healthmelevel+25
score=score+10
charm2x=160
charm2y=0
endif
return
Rem ***** Included Source File *****
debuginfo:
` show sprite coord.s
text 1,1,"sprite x:__"+str$(sprite x(hero))
text 1,20,"sprite y:__"+str$(sprite y(hero))
` show flags
rem text 1,30 ,"timer :__";timer()
text 1,70 ,"falling (NB:on=1,off=0):__"+str$(falling)
text 1,90 ,"jumping (NB:on=1,off=0):__"+str$(jumping)
text 1,110 ,"ducking (NB:on=1,off=0):__"+str$(ducking)
text 1,130,"gforce (NB:on=1,off=0):__"+str$(gforce)
text 1,150,"anim (NB:on=1,off=0):__"+str$(anim)
text 1,170,"current sprite colli..):__"+str$(sprite collision(hero,0))
text 1,190,"sprite collide x value :__"+str$(NoOverlap)
text 1,210,"hero jump height value :__"+str$(jumpheight)
text 1,230,"space (NB:on=1,off=0):__"+spacekey$+" "+str$(spacekey())
return
Rem ***** Included Source File *****
enemyai:
if sprite collision(hero,enemy1)=1
healthmelevel=healthmelevel-1
if healthmelevel=1 then healthmelevel=100
endif
if enemy1x < herox
enemy1x=enemy1x+1
endif
if enemy1x > herox
enemy1x=enemy1x-1
endif
if enemy1y < heroy
enemy1y=enemy1y+1
endif
if enemy1y > heroy
enemy1y=enemy1y-1
endif
return
` console
` declare console variables
` ############# note moved to main for debugging ################
hook_for_console_interupt:
if console$="off"
if scancode()=41
consolemarker=1
gosub wait_for_console_interupt
endif
endif
return
wait_for_console_interupt:
` if the console is off then if the tilde hey is pressed then go the the console
if consolemarker=1
exit
gosub at_console_interupt
endif
return
at_console_interupt:
cls
console$="on"
gosub console
return
console:
hide all sprites
if spr_panely<800
spr_panely=spr_panely+panel_expansion
endif
if console$="on"
print "console V 0.1"
do
` console input
` refreshing console input by emptying it every loop
console_input$=""
` current line
input username$;" @";interface$;"/";argument$;"/";element$;"/";consoleprompt$;"#";console_input$
`console background
rem paste sprite spr_panel,1,1
rem set sprite priority spr_panel,1
` displays console backdrop
rem paste image 100 ,0,0
` console commands
if interface$="root"
if console_input$="up"
argument$=PreviousArgument$
endif
if argument$="position"
if console_input$="down"
argument$=""
element$=""
PreviousArgument$="position"
endif
endif
if argument$="modify"
if console_input$="down"
argument$=""
element$=""
PreviousArgument$="modify"
endif
endif
if argument$="delete"
if console_input$="down"
argument$=""
element$=""
PreviousArgument$="delete"
endif
endif
if argument$="variable"
if console_input$="down"
argument$=""
element$=""
PreviousArgument$="variable"
endif
endif
if argument$="profile"
if console_input$="down"
argument$=""
element$=""
endif
if console_input$="up"
element$=PreviousElement$
endif
if element$="user name"
username$=console_input$
console_input$="down"
if console_input$="down"
element$=""
PreviousElement$="user name"
endif
endif
if element$="user password"
password$=console_input$
console_input$="down"
if console_input$="down"
element$=""
PreviousElement$="profile"
endif
endif
if console_input$="down"
argument$=""
PreviousElement$="user password"
endif
endif
endif
if upkey()=1
console_input$=temp$
endif
` position arguments *for positon specific elements eg. sprites
if console_input$="pos" or console_input$="position"
argument$="position"
endif
`modify arguments *mods elemnets
if console_input$="mod" or console_input$="modify"
argument$="modify"
endif
`modify arguments *mods variables
if console_input$="var" or console_input$="variable"
argument$="variable"
endif
`modify arguments deletes elements
if console_input$="del" or console_input$="delete"
argument$="delete"
endif
`modify arguments edits user profile variables
if console_input$="user"
argument$="profile"
endif
if argument$="profile"
`modify arguments edits user profile variables
if console_input$="user name" or console_input$="use n"
element$="user name"
endif
`modify arguments edits user profile variables
if console_input$="user password" or console_input$="use pass"
element$="user password"
endif
endif
`modify arguments clears path for root
if console_input$="home"
argument$=""
element$=""
PreviousArgument$=""
endif
if console_input$="?"
print "Modify (mod) ---- modifies a variable"
print "Position (pos) ---- positions an elemnet in game (x,y)"
print "home ---- brings you to the root of the console"
print "up ---- goes forward to a previous interface or to specified"
print "down ---- goes to precious interface"
print "variable (var) ---- value to change"
print "load ---- imports a external file"
print "delete (del) ---- erases an element form the program"
print "*? ---- where * is unknown interface"
print "user name(user) ---- change the user name"
print "user password (user pass) change the users password"
print "screenshot (*test) ---- testing the bitmap save feature"
print "interface, argument, element"
endif
` closes the console
if escapekey()=1
console$="off"
endif
if console_input$="`"
console$="off"
endif
if console_input$="exit"
console$="off"
endif
` quits game from console
if console_input$="quit"
end
endif
` jumps back to game
if console$="off"
show all sprites
gosub sub_MAINLOOP
endif
sync
loop
endif
return
guess what