Hello. I am trying to do 3rd person jumping. Here is my code so far. Its has a crummy jumping system at the moment. Could any1 try and improve this?
sync on
autocam off
hide mouse
make matrix 2,2000,2000,1,1
load image "water0001.jpg",2
prepare matrix texture 2,2,1,1
ghost matrix on 2
load object "bunker.3ds",1
load image "bunker.bmp",1
texture object 1,1
position object 1,445,15,557
bunker1=0
load object "bunker.3ds",2
load image "bunker1.bmp",4
texture object 2,4
position object 2,910,18,1007
rotate object 2,0,178,0
make object collision box 2,-50,-50,-50,50,50,50,0
bunker=1
load image "grass.bmp",1
load object "land.3ds",8
texture object 8,1
scale object 8,500,500,500
position object 8,671,15,760
load object "sky07.3ds",4
scale object 4,12000,15000,14000
position object 4,674,0,759
set object 4,1,0,1
load image "dirt.bmp",6
make object plain 6,3000,3000
texture object 6,6
position object 6,1018,-57,803
rotate object 6,90,0,0
fog on
red= rgb(255,57,0)
fog color red
fog distance 3000
load object "cat.3ds",7
position object 7,539,40,472
rotate object 7,0,270,0
make object collision box 7,-10,-10,-10,10,10,10,0
sync
player$= "on ground"
game:
do
posx#=object position x(7)
posy#=object position y(7)
posz#=object position z(7)
angle#=object angle y(7)
waterlevel=get ground height(2,x,y)
if object position y(7)<=waterlevel+7 then gosub die
if object collision(7,2)
position object 7,posx#,posy#,posz#
endif
camdist#=25 : camhigh#=posy#+10.0 : camfade#=3.5
set camera to follow posx#,posy#,posz#,angle#+180,camdist#,camhigh#,camfade#,1
point camera posx#,posy#,posz#
if upkey()=1 then move object 7,-2
if downkey()=1 then move object 7,2
if leftkey()=1 then yrotate object 7,wrapvalue(angle#-5)
if rightkey()=1 then yrotate object 7,wrapvalue(angle#+5)
if controlkey()=1 and player$= "on ground" then gosub jump
if shiftkey()=1 then position object 7,posx#,posy#-0.5,posz#
sync
loop
die:
do
position object 7,posx#,posy#,posz#
dec posy#,0.5
point camera posx#,posy#,posz#
sync
loop
return
jump:
do
position object 7,posx#,posy#,posz#
inc posy#,1
if object position y(7)=60 then gosub down
point camera posx#,posy#,posz#
sync
loop
down:
do
point camera posx#,posy#,posz#
position object 7,posx#,posy#,posz#
dec posy#,2
if object position y(7)=waterlevel+40 then position object 7,posx#,waterlevel+40,posz#:goto game
sync
loop
return
I am currently working on : A Medievil style game
By the way I'm 13 years old!!