I can't attach my game... here is the code but you need the media
the model have some invisible parts, like the shoulders
REM Project: Simple game
REM Created: 02/05/2009 22:13:57
REM
REM ***** Main Source File *****
REM
`Init
disable escapekey
set display mode 1024,768,32
sync on
sync rate 60
autocam off
backdrop on
color backdrop 0
set camera range 0.5,100000
Menu:
show mouse
x=Screen width()
y=Screen height()
global menu_end as boolean = 0
global load = 0
make object cube 10000,10
position object 10000,-10,0,0
position camera 0,0,0,-50
point camera 0,0,0
`The menu
repeat
mx#=mousex()
my#=mousey()
mc=mouseclick()
rotate object 10000,wrapvalue(object angle x(10000)+1),wrapvalue(object angle y(10000)+1),0
text x/2,y/2-100,"NEW GAME"
text x/2,y/2-50,"LOAD GAME"
text x/2,y/2,"SAVE GAME"
text x/2,y/2+50,"OPTIONS"
text x/2,y/2+100,"EXIT"
if mx#>x/2 and mx#<x/2+text width("NEW GAME") and my#>y/2-100 and my#<(y/2-100)+text height("NEW GAME")
ink rgb(128,128,128),0
text x/2,y/2-100,"NEW GAME"
ink rgb(255,255,255),0
text x/2,y/2-50,"LOAD GAME"
text x/2,y/2,"SAVE GAME"
text x/2,y/2+50,"OPTIONS"
text x/2,y/2+100,"EXIT"
else
ink rgb(255,255,255),0
endif
if mx#>x/2 and mx#<x/2+text width("LOAD GAME") and my#>y/2-50 and my#<(y/2-50)+text height("LOAD GAME")
ink rgb(255,255,255),0
text x/2,y/2-100,"NEW GAME"
ink rgb(128,128,128),0
text x/2,y/2-50,"LOAD GAME"
ink rgb(255,255,255),0
text x/2,y/2,"SAVE GAME"
text x/2,y/2+50,"OPTIONS"
text x/2,y/2+100,"EXIT"
else
ink rgb(255,255,255),0
endif
if mc=1 and load = 0 and mx#>x/2 and mx#<x/2+text width("LOAD GAME") and my#>y/2-50 and my#<(y/2-50)+text height("LOAD GAME")
load=1
goto Game
endif
if mc=1 and mx#>x/2 and mx#<x/2+text width("NEW GAME") and my#>y/2-100 and my#<(y/2-100)+text height("NEW GAME")
goto Game
endif
sync
until menu_end=1
if menu_end=1
end
endif
Game:
delete object 10000
`Types
hide mouse
type charpar
x as float
y as float
z as float
name as string
health as integer
power as integer
endtype
dim char(10) as charpar
`Variables
global player = 1
global health as integer = 100
gosub player_par
gosub loading_bar
gosub make_hud
gosub make_room
make_player()
make_box()
heroframe = total object frames(player)/200
Do
if escapekey()=1
xpos#=object position x(player)
ypos#=object position y(player)
zpos#=object position z(player)
goto return_menu
endif
if load=1
position object player,xpos#,ypos#,zpos#
load=0
endif
walk=0
ox#=object position x(player)
oy#=object position y(player)
oz#=object position z(player)
gosub control_player
x#=object position x(player)
y#=object position y(player)
z#=object position z(player)
c = sc_sphereslidegroup(1,ox#,oy#,oz#,x#,y#,z#,object size(player)/2,0)
if c>0
x#=sc_getcollisionslidex()
y#=sc_getcollisionslidey()
z#=sc_getcollisionslidez()
jump=0
endif
position object player,x#,y#,z#
hprogress(health)
if health<0 then health = 0
if power<0 then power = 0
sync
loop
control_player:
if rightkey()=1 then yrotate object player,wrapvalue(object angle y(player)+4):walk=1
if leftkey()=1 then yrotate object player,wrapvalue(object angle y(player)-4):walk=1
if upkey()=1 then move object player,4:walk=1
if downkey()=1 then move object player,-4:walk=1
if spacekey()=1 and jump=0
jump=1
force#=15.0
endif
y#=y#+force#
force#=force#-.5
if force#<-8.0 then force#=-8.0
position object player,object position x(player),y#,object position z(player)
set camera to follow object position x(player),object position y(player),object position z(player),object angle y(player),250.0,180.0,50.0,1
if walk=0 then loop object player,0*heroframe,39*heroframe
if walk=1 then loop object player,40*heroframe,59*heroframe
return
Function make_box()
make object plain 2,1500,1500
xrotate object 2,90
position object 2,0,0,0
texture object 2,1
scale object texture 2,10,10
sc_setupobject 2,1,0
endfunction
Function make_player()
load object "mediaheroninja.x",player
scale object player,30000,30000,30000
xrotate object player,0
fix object pivot player
rotate object player,0,180,0
set object speed player,1000
sc_setupcomplexobject player,0,10
endfunction
loading_bar:
progress("Loading images...",1/6.0)
load image "media/hero/floor.bmp",1
progress("Loading images...",2/6.0)
load image "media/hero/1 player.bmp",2
progress("Loading images...",3/6.0)
load image "media/hero/Health.png",3
progress("Loading images...",4/6.0)
load image "media/hero/WALLB.bmp",4
progress("Loading images...",5/6.0)
load image "media/hero/ROOF.bmp",5
progress("Loading images...",6/6.0)
load image "media/hero/nskinbl.jpg",6
return
Function progress(s$,prog#)
x = (screen width()/2)-128
y = (screen height()/2)
ink rgb(255,255,255),0
center text x+128,y-50,s$
ink rgb(16,16,16),0
box x-1,y-1,x+257,y+17
ink rgb(255,16,16),0
box x-1,y-1,x+1+(prog#*256),y+17
ink rgb(255,135,135),0
box prog_x-1,prog_y+5,prog_x+1+(prog#*256),prog_y+8
sync
endfunction
player_par:
char(1).name = "Yousef"
char(1).health = health
char(1).power = 200
global power = char(1).power
return
make_hud:
make object plain 10,476,40
set object light 10,100
ghost object on 10
texture object 10,2
scale object texture 10,1,1
position object 10,-39,280,500
lock object on 10
return
Function hprogress(health)
ink rgb(255,0,0),0
box 189,8,725,22
ink rgb(0,90,0),0
box 739-((health*5.5)/1),8,725,22
ink rgb(255,255,255),0
text (screen width()/2)-60,8, str$(health)
ink 0,0
box 303,35,728,40
ink rgb(0,0,90),0
box 740-((power*2.2)/1),35,728,40
ink rgb(255,255,255),0
text (screen width()/2)-10,30,str$(power)
endfunction
return_menu:
delete object 1
delete object 2
delete object 10
delete object 11
delete image 1
delete image 2
delete image 3
goto menu
return
make_room:
make object plain 13,1500,750
position object 13,0,375,750
texture object 13,4
scale object texture 13,4,2
sc_setupobject 13,1,0
make object plain 14,1500,750
texture object 14,4
scale object texture 14,4,2
yrotate object 14,90
position object 14,750,375,0
sc_setupobject 14,1,0
make object plain 15,1500,750
texture object 15,4
scale object texture 15,4,2
yrotate object 15,-90
position object 15,-750,375,0
sc_setupobject 15,1,0
make object plain 16,1500,750
texture object 16,4
scale object texture 16,4,2
position object 16,0,375,-750
sc_setupobject 16,1,0
make object plain 17,1500,1500
xrotate object 17,90
texture object 17,5
scale object texture 17,5,5
position object 17,0,500,-500
sc_setupobject 17,1,0
make object plain 18,1500,500
xrotate object 18,90
texture object 18,5
scale object texture 18,5,5
position object 18,0,750,500
sc_setupobject 18,1,0
make object plain 19,1500,300
texture object 19,5
scale object texture 19,2,2
position object 19,0,650,250
sc_setupobject 19,1,0
return