I've got a stupid problem: there is a variable with the name force#
if I set it to 10.0 then the cam glide to the lowest point in the map. If I set it to 100.0 then it doesn't but then I can walk over very hight hills. why?????? (Need help please)
I'am a idiot
and maybe this can help (this is a part of my game with this problem)
http://www.onlineartsgames.de/Matrix.rar
here is the code search for force#
rem Game settings
hide mouse
color backdrop rgb(0,0,0)
autocam off
set camera range 1,1000000
sync on
set mipmap mode 500
rem Arrays and variables
dim playergrav(50)
dim player_object(50)
player_object(1)=1
rem Change mode
set display mode 1024,768,16
rem Make a matrix
make matrix 1,10000,20000,70,70
position matrix 1,0,0,0
randomize matrix 1,(50-20)
set matrix texture 1,1,1
make matrix 3,10000,20000,70,70
position matrix 3,0,0,20000
randomize matrix 3,(50-20)
set matrix texture 3,1,1
rem Make stairs
for t=2 to 20
make object box t,1000,t*20,50 : position object t,5000,t*10,t*50+4900
next t
rem Make mountains
set matrix height 1,0,0,870
set matrix height 1,0,1,870
set matrix height 1,0,2,880
set matrix height 1,0,3,950
set matrix height 1,0,4,930
set matrix height 1,0,5,910
set matrix height 1,0,6,890
set matrix height 1,0,7,850
set matrix height 1,0,8,880
set matrix height 1,0,9,910
set matrix height 1,0,10,980
set matrix height 1,0,11,940
set matrix height 1,0,12,910
set matrix height 1,0,13,950
set matrix height 1,1,0,870
set matrix height 1,1,1,870
set matrix height 1,1,2,880
set matrix height 1,1,3,950
set matrix height 1,1,4,930
set matrix height 1,1,5,910
set matrix height 1,1,6,890
set matrix height 1,1,7,850
set matrix height 1,1,8,880
set matrix height 1,1,9,910
set matrix height 1,1,10,980
set matrix height 1,1,11,940
set matrix height 1,1,12,910
set matrix height 1,2,0,870
set matrix height 1,2,1,870
set matrix height 1,2,2,880
set matrix height 1,2,3,950
set matrix height 1,2,4,930
set matrix height 1,2,5,910
set matrix height 1,2,6,890
set matrix height 1,2,7,850
set matrix height 1,2,8,880
set matrix height 1,2,9,910
set matrix height 1,2,10,980
set matrix height 1,2,11,940
set matrix height 1,3,0,870
set matrix height 1,3,1,870
set matrix height 1,3,2,880
set matrix height 1,3,3,950
set matrix height 1,3,4,930
set matrix height 1,3,5,910
set matrix height 1,3,6,890
set matrix height 1,3,7,850
set matrix height 1,3,8,880
set matrix height 1,3,9,910
set matrix height 1,3,10,980
set matrix height 1,4,0,870
set matrix height 1,4,1,870
set matrix height 1,4,2,880
set matrix height 1,4,3,950
set matrix height 1,4,4,930
set matrix height 1,4,5,910
set matrix height 1,4,6,890
set matrix height 1,4,7,850
set matrix height 1,4,8,880
set matrix height 1,4,9,910
set matrix height 1,5,0,870
set matrix height 1,5,1,870
set matrix height 1,5,2,880
set matrix height 1,5,3,950
set matrix height 1,5,4,930
set matrix height 1,5,5,910
set matrix height 1,5,6,890
set matrix height 1,5,7,850
set matrix height 1,5,8,880
set matrix height 1,6,0,870
set matrix height 1,6,1,870
set matrix height 1,6,2,880
set matrix height 1,6,3,950
set matrix height 1,6,4,930
set matrix height 1,6,5,910
set matrix height 1,6,6,890
set matrix height 1,6,7,850
set matrix height 1,7,0,870
set matrix height 1,7,1,870
set matrix height 1,7,2,880
set matrix height 1,7,3,950
set matrix height 1,7,4,930
set matrix height 1,7,5,910
set matrix height 1,7,6,890
set matrix height 1,8,0,870
set matrix height 1,8,1,870
set matrix height 1,8,2,880
set matrix height 1,8,3,950
set matrix height 1,8,4,930
set matrix height 1,8,5,910
set matrix height 1,9,0,870
set matrix height 1,9,1,870
set matrix height 1,9,2,880
set matrix height 1,9,3,950
set matrix height 1,9,4,930
set matrix height 1,9,5,910
set matrix height 1,10,0,870
set matrix height 1,10,1,870
set matrix height 1,10,2,880
set matrix height 1,10,3,950
set matrix height 1,10,4,930
set matrix height 1,10,5,910
set matrix height 1,11,0,870
set matrix height 1,11,1,870
set matrix height 1,11,2,880
set matrix height 1,11,3,950
set matrix height 1,11,4,930
set matrix height 1,11,5,910
set matrix height 1,12,0,870
set matrix height 1,12,1,870
set matrix height 1,12,2,880
set matrix height 1,12,3,950
set matrix height 1,12,4,930
set matrix height 1,12,5,910
set matrix height 1,13,0,870
set matrix height 1,13,1,870
set matrix height 1,13,2,880
set matrix height 1,13,3,950
set matrix height 1,13,4,930
set matrix height 1,13,5,910
set matrix height 1,14,0,870
set matrix height 1,14,1,870
set matrix height 1,14,2,880
set matrix height 1,14,3,950
set matrix height 1,14,4,930
set matrix height 1,14,5,910
set matrix height 1,15,0,870
set matrix height 1,15,1,870
set matrix height 1,15,2,880
set matrix height 1,15,3,950
set matrix height 1,15,4,930
set matrix height 1,15,5,910
set matrix height 1,16,0,870
set matrix height 1,16,1,870
set matrix height 1,16,2,880
set matrix height 1,16,3,950
set matrix height 1,16,4,930
set matrix height 1,17,0,870
set matrix height 1,17,1,870
set matrix height 1,17,2,880
set matrix height 1,17,3,950
set matrix height 1,18,0,870
set matrix height 1,18,1,870
set matrix height 1,18,2,880
set matrix height 1,19,0,870
set matrix height 1,19,1,880
set matrix height 1,18,0,870
set matrix height 1,18,1,880
set matrix height 1,19,0,870
set matrix height 1,19,1,880
set matrix height 1,20,0,910
set matrix height 1,20,1,920
set matrix height 1,20,2,930
set matrix height 1,21,0,930
set matrix height 1,21,1,920
set matrix height 1,21,2,910
set matrix height 1,22,0,900
set matrix height 1,22,1,920
set matrix height 1,22,2,910
set matrix height 1,23,0,880
set matrix height 1,23,1,960
set matrix height 1,23,2,940
set matrix height 1,24,0,870
set matrix height 1,24,1,880
set matrix height 1,24,2,890
set matrix height 1,25,0,910
set matrix height 1,25,1,890
set matrix height 1,25,2,900
set matrix height 1,26,0,930
set matrix height 1,26,1,920
set matrix height 1,26,2,910
set matrix height 1,26,3,920
set matrix height 1,27,0,910
set matrix height 1,27,1,890
set matrix height 1,27,2,900
set matrix height 1,28,0,900
set matrix height 1,28,1,910
set matrix height 1,28,2,930
set matrix height 1,28,3,850
set matrix height 1,29,0,930
set matrix height 1,29,1,900
set matrix height 1,29,2,890
set matrix height 1,30,0,910
set matrix height 1,30,1,900
set matrix height 1,30,2,890
set matrix height 1,30,3,900
set matrix height 1,31,0,870
set matrix height 1,31,1,920
set matrix height 1,31,2,910
set matrix height 1,32,0,910
set matrix height 1,32,1,920
set matrix height 1,33,0,920
set matrix height 1,33,1,880
set matrix height 1,34,0,960
set matrix height 1,35,0,900
set matrix height 1,36,0,960
set matrix height 1,37,0,920
set matrix height 1,37,1,880
set matrix height 1,38,0,910
set matrix height 1,38,1,920
set matrix height 1,39,0,870
set matrix height 1,39,1,920
set matrix height 1,39,2,910
set matrix height 1,40,0,910
set matrix height 1,40,1,900
set matrix height 1,40,2,890
set matrix height 1,40,3,900
set matrix height 1,41,0,930
set matrix height 1,41,1,900
set matrix height 1,41,2,890
set matrix height 1,42,0,900
set matrix height 1,42,1,910
set matrix height 1,42,2,930
set matrix height 1,42,3,850
set matrix height 1,43,0,910
set matrix height 1,43,1,890
set matrix height 1,43,2,900
set matrix height 1,44,0,930
set matrix height 1,44,1,920
set matrix height 1,44,2,910
set matrix height 1,44,3,920
set matrix height 1,45,0,910
set matrix height 1,45,1,890
set matrix height 1,45,2,900
set matrix height 1,46,0,870
set matrix height 1,46,1,880
set matrix height 1,46,2,890
set matrix height 1,47,0,880
set matrix height 1,47,1,960
set matrix height 1,47,2,940
set matrix height 1,48,0,900
set matrix height 1,48,1,920
set matrix height 1,48,2,910
set matrix height 1,49,0,930
set matrix height 1,49,1,920
set matrix height 1,49,2,910
set matrix height 1,50,0,910
set matrix height 1,50,1,920
set matrix height 1,50,2,930
set matrix height 1,51,0,870
set matrix height 1,51,1,880
set matrix height 1,52,0,870
set matrix height 1,52,1,870
set matrix height 1,52,2,880
set matrix height 1,53,0,870
set matrix height 1,53,1,870
set matrix height 1,53,2,880
set matrix height 1,54,0,870
set matrix height 1,54,1,870
set matrix height 1,54,2,880
set matrix height 1,54,3,950
set matrix height 1,54,4,930
set matrix height 1,55,0,870
set matrix height 1,55,1,870
set matrix height 1,55,2,880
set matrix height 1,55,3,950
set matrix height 1,55,4,930
set matrix height 1,55,5,910
set matrix height 1,56,0,870
set matrix height 1,56,1,870
set matrix height 1,56,2,880
set matrix height 1,56,3,950
set matrix height 1,56,4,930
set matrix height 1,56,5,910
set matrix height 1,57,0,870
set matrix height 1,57,1,870
set matrix height 1,57,2,880
set matrix height 1,57,3,950
set matrix height 1,57,4,930
set matrix height 1,57,5,910
set matrix height 1,58,0,870
set matrix height 1,58,1,870
set matrix height 1,58,2,880
set matrix height 1,58,3,950
set matrix height 1,58,4,930
set matrix height 1,58,5,910
set matrix height 1,59,0,870
set matrix height 1,59,1,870
set matrix height 1,59,2,880
set matrix height 1,59,3,950
set matrix height 1,59,4,930
set matrix height 1,59,5,910
set matrix height 1,60,0,870
set matrix height 1,60,1,870
set matrix height 1,60,2,880
set matrix height 1,60,3,950
set matrix height 1,60,4,930
set matrix height 1,60,5,910
set matrix height 1,61,0,870
set matrix height 1,61,1,870
set matrix height 1,61,2,880
set matrix height 1,61,3,950
set matrix height 1,61,4,930
set matrix height 1,61,5,910
set matrix height 1,62,0,870
set matrix height 1,62,1,870
set matrix height 1,62,2,880
set matrix height 1,62,3,950
set matrix height 1,62,4,930
set matrix height 1,62,5,910
set matrix height 1,63,0,870
set matrix height 1,63,1,870
set matrix height 1,63,2,880
set matrix height 1,63,3,950
set matrix height 1,63,4,930
set matrix height 1,63,5,910
set matrix height 1,63,6,890
set matrix height 1,64,0,870
set matrix height 1,64,1,870
set matrix height 1,64,2,880
set matrix height 1,64,3,950
set matrix height 1,64,4,930
set matrix height 1,64,5,910
set matrix height 1,64,6,890
set matrix height 1,64,7,850
set matrix height 1,65,0,870
set matrix height 1,65,1,870
set matrix height 1,65,2,880
set matrix height 1,65,3,950
set matrix height 1,65,4,930
set matrix height 1,65,5,910
set matrix height 1,65,6,890
set matrix height 1,65,7,850
set matrix height 1,65,8,880
set matrix height 1,66,0,870
set matrix height 1,66,1,870
set matrix height 1,66,2,880
set matrix height 1,66,3,950
set matrix height 1,66,4,930
set matrix height 1,66,5,910
set matrix height 1,66,6,890
set matrix height 1,66,7,850
set matrix height 1,66,8,880
set matrix height 1,66,9,910
set matrix height 1,67,0,870
set matrix height 1,67,1,870
set matrix height 1,67,2,880
set matrix height 1,67,3,950
set matrix height 1,67,4,930
set matrix height 1,67,5,910
set matrix height 1,67,6,890
set matrix height 1,67,7,850
set matrix height 1,67,8,880
set matrix height 1,67,9,910
set matrix height 1,67,10,980
set matrix height 1,68,0,870
set matrix height 1,68,1,870
set matrix height 1,68,2,880
set matrix height 1,68,3,950
set matrix height 1,68,4,930
set matrix height 1,68,5,910
set matrix height 1,68,6,890
set matrix height 1,68,7,850
set matrix height 1,68,8,880
set matrix height 1,68,9,910
set matrix height 1,68,10,980
set matrix height 1,68,11,940
set matrix height 1,69,0,870
set matrix height 1,69,1,870
set matrix height 1,69,2,880
set matrix height 1,69,3,950
set matrix height 1,69,4,930
set matrix height 1,69,5,910
set matrix height 1,69,6,890
set matrix height 1,69,7,850
set matrix height 1,69,8,880
set matrix height 1,69,9,910
set matrix height 1,69,10,980
set matrix height 1,69,11,940
set matrix height 1,69,12,910
set matrix height 1,70,0,870
set matrix height 1,70,1,870
set matrix height 1,70,2,880
set matrix height 1,70,3,950
set matrix height 1,70,4,930
set matrix height 1,70,5,910
set matrix height 1,70,6,890
set matrix height 1,70,7,850
set matrix height 1,70,8,880
set matrix height 1,70,9,910
set matrix height 1,70,10,980
set matrix height 1,70,11,940
set matrix height 1,70,12,910
set matrix height 1,70,13,950
rem Side mountains
for t=13 to 70
xm#=rnd(6)
if xm#=0
set matrix height 1,xm#,t,rnd(100)+800
endif
if xm#=1
set matrix height 1,xm#,t,rnd(100)+800
set matrix height 1,xm#-1,t,rnd(100)+800
endif
if xm#=2
set matrix height 1,xm#,t,rnd(100)+800
set matrix height 1,xm#-1,t,rnd(100)+800
set matrix height 1,xm#-2,t,rnd(100)+800
endif
if xm#=3
set matrix height 1,xm#,t,rnd(100)+800
set matrix height 1,xm#-1,t,rnd(100)+800
set matrix height 1,xm#-2,t,rnd(100)+800
set matrix height 1,xm#-3,t,rnd(100)+800
endif
if xm#=4
set matrix height 1,xm#,t,rnd(100)+800
set matrix height 1,xm#-1,t,rnd(100)+800
set matrix height 1,xm#-2,t,rnd(100)+800
set matrix height 1,xm#-3,t,rnd(100)+800
set matrix height 1,xm#-4,t,rnd(100)+800
endif
if xm#=5
set matrix height 1,xm#,t,rnd(100)+800
set matrix height 1,xm#-1,t,rnd(100)+800
set matrix height 1,xm#-2,t,rnd(100)+800
set matrix height 1,xm#-3,t,rnd(100)+800
set matrix height 1,xm#-4,t,rnd(100)+800
set matrix height 1,xm#-5,t,rnd(100)+800
endif
if xm#=6
set matrix height 1,xm#,t,rnd(100)+800
set matrix height 1,xm#-1,t,rnd(100)+800
set matrix height 1,xm#-2,t,rnd(100)+800
set matrix height 1,xm#-3,t,rnd(100)+800
set matrix height 1,xm#-4,t,rnd(100)+800
set matrix height 1,xm#-5,t,rnd(100)+800
set matrix height 1,xm#-6,t,rnd(100)+800
endif
next t
for t=13 to 70
xm#=rnd(6)
if xm#=0
set matrix height 1,xm#+70,t,rnd(100)+800
endif
if xm#=1
set matrix height 1,xm#+69,t,rnd(100)+800
set matrix height 1,xm#+68,t,rnd(100)+800
endif
if xm#=2
set matrix height 1,xm#+68,t,rnd(100)+800
set matrix height 1,xm#+67,t,rnd(100)+800
set matrix height 1,xm#+66,t,rnd(100)+800
endif
if xm#=3
set matrix height 1,xm#+67,t,rnd(100)+800
set matrix height 1,xm#+66,t,rnd(100)+800
set matrix height 1,xm#+65,t,rnd(100)+800
set matrix height 1,xm#+64,t,rnd(100)+800
endif
if xm#=4
set matrix height 1,xm#+66,t,rnd(100)+800
set matrix height 1,xm#+65,t,rnd(100)+800
set matrix height 1,xm#+64,t,rnd(100)+800
set matrix height 1,xm#+63,t,rnd(100)+800
set matrix height 1,xm#+62,t,rnd(100)+800
endif
if xm#=5
set matrix height 1,xm#+65,t,rnd(100)+800
set matrix height 1,xm#+64,t,rnd(100)+800
set matrix height 1,xm#+63,t,rnd(100)+800
set matrix height 1,xm#+62,t,rnd(100)+800
set matrix height 1,xm#+61,t,rnd(100)+800
set matrix height 1,xm#+60,t,rnd(100)+800
endif
if xm#=6
set matrix height 1,xm#+64,t,rnd(100)+800
set matrix height 1,xm#+63,t,rnd(100)+800
set matrix height 1,xm#+62,t,rnd(100)+800
set matrix height 1,xm#+61,t,rnd(100)+800
set matrix height 1,xm#+60,t,rnd(100)+800
set matrix height 1,xm#+59,t,rnd(100)+800
set matrix height 1,xm#+58,t,rnd(100)+800
endif
next t
rem River
for t=30 to 40
set matrix height 1,t,5,-1500
set matrix height 1,t,6,-1500
set matrix height 1,t,7,-1500
set matrix height 1,t,8,-1500
set matrix height 1,t,9,-1500
set matrix height 1,t,10,-1500
set matrix height 1,t,11,-1500
set matrix height 1,t,12,-1500
set matrix height 1,t,15,-1500
next t
rem Make river round
set matrix height 1,30,5,1
set matrix height 1,31,5,1
set matrix height 1,32,5,1
set matrix height 1,30,6,1
set matrix height 1,30,7,1
set matrix height 1,30,12,1
set matrix height 1,30,13,1
set matrix height 1,30,14,1
set matrix height 1,30,15,1
set matrix height 1,31,14,1
set matrix height 1,32,15,1
set matrix height 1,33,15,1
set matrix height 1,34,15,1
set matrix height 1,39,15,1
set matrix height 1,40,15,1
set matrix height 1,40,14,1
set matrix height 1,40,12,1
set matrix height 1,40,2,1
set matrix height 1,40,1,1
set matrix height 1,40,0,1
set matrix height 1,39,0,1
set matrix height 1,35,15,1
set matrix height 1,37,15,1
set matrix height 1,38,15,1
set matrix height 1,39,15,1
set matrix height 1,40,15,1
set matrix height 1,30,15,1
set matrix height 1,31,15,1
rem Set river grounds a bit higher than some places
set matrix height 1,32,5,rnd(200)-1500
set matrix height 1,32,6,rnd(200)-1500
set matrix height 1,31,6,rnd(200)-1500
set matrix height 1,31,7,rnd(200)-1500
set matrix height 1,30,7,rnd(200)-1500
set matrix height 1,30,8,rnd(200)-1500
set matrix height 1,30,9,rnd(200)-1500
set matrix height 1,30,10,rnd(200)-1500
set matrix height 1,30,11,rnd(200)-1500
set matrix height 1,30,12,rnd(200)-1500
rem Make the river be shallow to deep
set matrix height 1,32,5,-100
set matrix height 1,33,5,-120
set matrix height 1,34,5,-110
set matrix height 1,35,5,-90
set matrix height 1,36,5,-95
set matrix height 1,37,5,-90
set matrix height 1,38,5,-100
set matrix height 1,39,5,-90
set matrix height 1,40,5,-120
set matrix height 1,40,6,-110
set matrix height 1,40,7,-115
set matrix height 1,40,8,-90
set matrix height 1,40,9,-100
set matrix height 1,40,10,-110
set matrix height 1,40,11,-95
set matrix height 1,40,12,-85
set matrix height 1,40,13,-120
set matrix height 1,40,14,-110
set matrix height 1,40,15,-100
set matrix height 1,39,15,-110
set matrix height 1,38,15,-90
set matrix height 1,37,15,-96
set matrix height 1,36,15,-85
set matrix height 1,35,15,-120
set matrix height 1,34,15,-110
set matrix height 1,33,15,-90
set matrix height 1,32,15,-85
set matrix height 1,31,15,-80
set matrix height 1,39,12,-80
set matrix height 1,38,12,-85
set matrix height 1,37,12,-96
set matrix height 1,36,12,-90
set matrix height 1,35,12,-110
set matrix height 1,34,12,-120
set matrix height 1,33,12,-85
set matrix height 1,32,12,-90
set matrix height 1,31,12,-110
set matrix height 1,30,12,-100
set matrix height 1,30,11,-90
set matrix height 1,30,10,-120
set matrix height 1,30,9,-110
set matrix height 1,30,8,-80
set matrix height 1,30,7,-100
set matrix height 1,30,6,-115
set matrix height 1,31,6,-185
set matrix height 1,32,6,-195
set matrix height 1,33,6,-220
set matrix height 1,34,6,-180
set matrix height 1,35,6,-200
set matrix height 1,36,6,-220
set matrix height 1,37,6,-180
set matrix height 1,38,6,-195
set matrix height 1,39,6,-180
set matrix height 1,31,6,-185
set matrix height 1,32,6,-195
set matrix height 1,33,6,-220
set matrix height 1,34,6,-180
set matrix height 1,35,6,-200
set matrix height 1,36,6,-220
set matrix height 1,37,6,-180
set matrix height 1,38,6,-195
set matrix height 1,39,7,-200
set matrix height 1,39,8,-220
set matrix height 1,39,9,-180
set matrix height 1,39,10,-190
set matrix height 1,39,11,-185
set matrix height 1,39,12,-180
set matrix height 1,39,13,-220
set matrix height 1,39,11,-310
set matrix height 1,38,11,-280
set matrix height 1,37,11,-290
set matrix height 1,36,11,-285
set matrix height 1,35,11,-310
set matrix height 1,34,11,-320
set matrix height 1,33,11,-305
set matrix height 1,32,11,-300
set matrix height 1,31,11,-280
set matrix height 1,31,10,-320
set matrix height 1,31,9,-300
set matrix height 1,31,8,-285
set matrix height 1,31,7,-295
set matrix height 1,32,7,-495
set matrix height 1,33,7,-500
set matrix height 1,34,7,-520
set matrix height 1,35,7,-505
set matrix height 1,36,7,-495
set matrix height 1,37,7,-485
set matrix height 1,38,7,-515
set matrix height 1,38,8,-505
set matrix height 1,38,9,-525
set matrix height 1,38,10,-485
set matrix height 1,38,11,-495
set matrix height 1,38,12,-515
set matrix height 1,37,7,-615
set matrix height 1,37,8,-505
set matrix height 1,37,9,-525
set matrix height 1,37,10,-485
set matrix height 1,37,11,-495
set matrix height 1,37,12,-515
set matrix height 1,36,7,-715
set matrix height 1,36,8,-505
set matrix height 1,36,9,-525
set matrix height 1,36,10,-485
set matrix height 1,36,11,-495
set matrix height 1,36,12,-515
set matrix height 1,35,10,-500
set matrix height 1,34,10,-495
set matrix height 1,33,10,-485
set matrix height 1,32,10,-500
set matrix height 1,32,9,-580
set matrix height 1,32,8,-600
set matrix height 1,33,8,-620
set matrix height 1,34,8,-640
set matrix height 1,35,8,-680
set matrix height 1,36,8,-700
set matrix height 1,33,8,-900
set matrix height 1,33,9,-920
set matrix height 1,34,8,-880
set matrix height 1,34,9,-905
set matrix height 1,35,9,-910
rem Update matrix
update matrix 1
rem Make the character
make object cube 1,50
hide object 1
rem Starting variables
position object 1,5000,300,500
x#=5000
y#=300
z#=500
x2#=5000
z2#=500
position camera 5000,100,10000
rem stop the player from being able to jump until there is a collision
playergrav(1)=1
rem Make collision boxes
set_collision(1,1,65535)
rem Do loop
do
rem Walk and run toggle
if shiftkey()=1 then walk=1 else walk=0
rem Control Player
if die#=0
if playergrav(1)=0
if swim#=0
if walk=0
stage=0 : gunlag#=5.0
if keystate(200)=1 or keystate(17)=1
x#=newxvalue(x#,cya#,10.0) : z#=newzvalue(z#,cya#,10.0)
gunlag#=1.3
stage=1
if air1#<10 then inc air1#,1 : air2#=0
endif
if keystate(208)=1 or keystate(31)=1
x#=newxvalue(x#,cya#,-10.0) : z#=newzvalue(z#,cya#,-10.0)
gunlag#=1.3
stage=1
if air2#<10 then inc air2#,1 : air1#=0
endif
if keystate(30)=1
x#=newxvalue(x#,wrapvalue(cya#-90.0),6.0)
z#=newzvalue(z#,wrapvalue(cya#-90.0),6.0)
gunlag#=1.3
if air3#<6 then inc air3#,1 : air4#=0
endif
if keystate(32)=1
x#=newxvalue(x#,wrapvalue(cya#+90.0),6.0)
z#=newzvalue(z#,wrapvalue(cya#+90.0),6.0)
gunlag#=1.3
if air4#<6 then inc air4#,1 : air3#=0
endif
if keystate(203)=1
cya#=cya#-7
endif
if keystate(205)=1
cya#=cya#+7
endif
endif
if walk=1
stage=0 : gunlag#=5.0
if keystate(200)=1 or keystate(17)=1
x#=newxvalue(x#,cya#,6.0) : z#=newzvalue(z#,cya#,6.0)
gunlag#=1.3
stage=1
endif
if keystate(208)=1 or keystate(31)=1
x#=newxvalue(x#,cya#,-6.0) : z#=newzvalue(z#,cya#,-6.0)
gunlag#=1.3
stage=1
endif
if keystate(30)=1
x#=newxvalue(x#,wrapvalue(cya#-90.0),4.5)
z#=newzvalue(z#,wrapvalue(cya#-90.0),4.5)
gunlag#=1.3
endif
if keystate(32)=1
x#=newxvalue(x#,wrapvalue(cya#+90.0),4.5)
z#=newzvalue(z#,wrapvalue(cya#+90.0),4.5)
gunlag#=1.3
endif
if keystate(203)=1
cya#=cya#-7
endif
if keystate(205)=1
cya#=cya#+7
endif
endif
endif
endif
endif
rem Swim
if die#=0
if y#<0 then swim#=1 else swim#=0
if gamma#=0 and y#<-50 then gamma#=1 : set gamma 150,150,225
if gamma#=1 and y#>-50 then gamma#=0 : set gamma 225,225,225 : fog on : fog color rgb(0,50,0) : fog distance 50000
if swim#=1
rotate object 1,wrapvalue(cxa#),wrapvalue(cya#),0
playergrav(1)=0
if keystate(17)=1
if air1#<15 then inc air1#,5
else
if air1#>0 then dec air1#,1
endif
if keystate(31)=1
if air2#<15 then inc air2#,5
else
if air2#>0 then dec air2#,1
endif
if air1#>0 then move object 1,air1#
if air2#>0 then move object 1,0-air2#
x#=object position x(1)
z#=object position z(1)
y#=object position y(1)
endif
if playergrav(1)=1 and swim#=0
if air1#>0 then x#=newxvalue(x#,aircya#,air1#) : z#=newzvalue(z#,aircya#,air1#)
if air2#>0 then x#=newxvalue(x#,aircya#,0-air2#) : z#=newzvalue(z#,aircya#,0-air2#)
if air3#>0 then x#=newxvalue(x#,aircya#-90,air3#) : z#=newzvalue(z#,aircya#-90,air3#)
if air4#>0 then x#=newxvalue(x#,aircya#+90,air4#) : z#=newzvalue(z#,aircya#+90,air4#)
endif
if playergrav(1)=0 and swim#=0
if keystate(17)=0 and air1#>0 then dec air1#,2
if keystate(31)=0 and air2#>0 then dec air2#,2
if keystate(30)=0 and air3#>0 then dec air3#,1.5
if keystate(32)=0 and air4#>0 then dec air4#,1.5
endif
endif
rem Walk woddle height
if stage=1
walkha#=wrapvalue(walkha#+16.0)
else
walkha#=curveangle(0.0,walkha#,5.0)
endif
walkh#=(cos(walkha#)*4.5)
rem Ensure player stays on floor
fx#=0 : fz#=0
for r=0 to 35
ex#=newxvalue(x#,r*10,15)
ez#=newzvalue(z#,r*10,15)
eh#=get ground height(1,ex#+mx#,ez#+mz#) + get ground height(3,ex#+mx#,ez#+mz#)
if eh#<-50.0 then eh#=-50.0
rem ===============================================================================================================
rem ===============================================================================================================
rem ===============================================================================================================
rem ===============================================================================================================
rem ============here is the problem =================================================================
rem ===============================================================================================================
rem ===============================================================================================================
rem =========== if I set force# to ..../10.0 then the camera go to the lowest point of the matrix =================
rem ==================================== if I set it to 100 then I can walk over very hight hills =================
rem ===============================================================================================================
force#=(eh#+50.0)/10.0
fx#=fx#+((ex#-x#)*force#)
fz#=fz#+((ez#-z#)*force#)
next r
rem ===============================================================================================================
rem ===============================================================================================================
rem ===============================================================================================================
x#=x#-(fx#/75.0)
z#=z#-(fz#/75.0)
rem ===============================================================================================================
rem Update character
position object 1,x#,y#,z#
rem Control Camera
cya#=wrapvalue(cya#+(mousemovex()/3.0))
cxa#=cxa#+(mousemovey()/3.0)
if cxa#<-90.0 then cxa#=-90.0
if cxa#>90.0 then cxa#=90.0
x2#=curvevalue(x#,x2#,2)
y2#=curvevalue(y#,y2#,2)
z2#=curvevalue(z#,z2#,2)
if playergrav(1)=0 then aircya#=cya#
if swim#=0 then position camera x2#,y2#+50+walkh#,z2#
if swim#=1 then position camera object position x(1),object position y(1)+50+walkh#,object position z(1)
rotate camera wrapvalue(cxa#),wrapvalue(cya#),0
rem Apply decay to gravity
if swim#=0 and gravity#<15.0 then gravity#=gravity#+0.5 else gravity#=15.0
if swim#=1 and gravity#<5.0 then gravity#=gravity#+0.5 else gravity#=5.0
rem Fall faster if falling
if playergrav(1)=1 then inc gravity2#,1
if playergrav(1)=1 then inc gravity#,gravity2#
if playergrav(1)=0 then gravity2#=0
rem Jump
if spacekey()=1 and hold=0 and playergrav(1)=0 and swim#=0 then gravity#=-200 : hold=1 : playergrav(1)=1
if spacekey()=0 then hold=0
rem Do collision
do_collision(1,gravity#,50.0)
rem Re-new xyz variables, for the use of collision
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
a#=object angle y(1)
rem End loop
sync
loop
`--------------------------------------
`set collision boxes with this function
`--------------------------------------
function set_collision(objid,start_obj,end_obj)
`set player collision
`see notes below for what is happening here
x1=-1*(object size x(objid)/2)
y1=-1*(object size y(objid)/2)
z1=-1*(object size z(objid)/2)
x2=(object size x(objid)/2)
y2=(object size y(objid)/2)
z2=(object size z(objid)/2)
make object collision box objid,x1,y1,z1,x2,y2,z2,0
`make object collision boxes
`these work by assuming the object is positioned at the origin (0,0,0)
`then you enter the object bounding box (an inivisble box that surrounds the object)
`to do this you must:-
`work out the size of the object (on all axis)
`divide each size by two - to work out half the width/ height/ depth
`multiply one of them by -1
`this works out the bounding regions of the object
for i=start_obj to end_obj
if object exist(i)
x1=-1*(object size x(i)/2)
y1=-1*(object size y(i)/2)
z1=-1*(object size z(i)/2)
x2=(object size x(i)/2)
y2=(object size y(i)/2)
z2=(object size z(i)/2)
`the 0 at the end tells DB that the box is not rotatable
`if it was then you would not be able to use the get object collision commands
make object collision box i,x1,y1,z1,x2,y2,z2,0
endif
next i
endfunction
`----------------------
`sort out the collision
`----------------------
function do_collision(id,gravity#,step_size#)
object_id=1
x#=object position x(object_id)
y#=object position y(object_id) : oldy#=y#
z#=object position z(object_id)
grav=playergrav(id)
`add step size and subtract gravity
if grav=0
y#=y#+step_size#-gravity#
else
y#=y#-gravity#
endif
`reposition
position object object_id,x#,y#,z#
`x + z collision
if swim#=0
if object collision(object_id,0)>0
x#=x#-get object collision x()
z#=z#-get object collision z()
`set player gravity off
playergrav(id)=1
endif
endif
`subtract step size
if grav=0
y#=y#-step_size#
endif
`reposition
position object object_id,x#,y#,z#
`y collision
if object collision(object_id,0)>0
y#=y#-get object collision y()
rem Reset player gravity
playergrav(id)=0
endif
rem Matrix height stuff
matrixheight#=get ground height(1,x#-matrix position x(1),z#-matrix position z(1))+(object size x(id)/2)+matrix position y(1)
matrixheight#=matrixheight#+get ground height(3,x#-matrix position x(1),z#-matrix position z(1))+(object size x(id)/2)+matrix position y(1)
if y#<matrixheight# then y#=matrixheight# : playergrav(id)=0 else playergrav(id)=1
rem Show that on ground and should walk if collision
if object collision(1,0)>0 then playergrav(1)=0
`smooth the y climbing
y#=curvevalue(y#,oldy#,1)
position object object_id,x#,y#,z#
endfunction
Download Desert Dead DBCFPS at http:\\www.onlineartsgames.de