Hey guys, having a bit of trouble working the fov and stuff out. Could someone show us how to implement zoomming on the camera?
Most of the snippets i've tried have worked, but the mouse controls cease to work or other retarded problems.
If someone could implement it so you press something and the camera zooms right in and you can still move the mouse?
Eternally grateful.
Rem Project: Dark Basic Pro Project
Rem Created: Tuesday, November 30, 2010
Rem ***** Main Source File *****
autocam off:hide mouse
create bitmap 1,50,50:for i= 1 to 1550:ink rgb(30,255,55),0:line rnd(60),i,i,rnd(130)
next i:blur bitmap 1,6:get image 1,10,10,50,50:delete bitmap 1
sync on
Type dogs
eat as float
drink as float
sleepeness as float
object as integer
state as integer
speed as float
desx as float
desy as float
desz as float
Endtype
Dim dogs(4) as dogs
for x=0 to 4
dogs(x).eat = 600+rnd(40)
dogs(x).drink = 600+rnd(40)
dogs(x).sleepeness = 500+rnd(50)
dogs(x).object = x+1
dogs(x).state = 4
dogs(x).speed = 2.9
dogs(x).desx=rnd(1000)
dogs(x).desy=0.5
dogs(x).desz=rnd(1000)
make object cube x+1,1
color object x+1,rgb(0,120,0)
set object emissive x+1,rgb(0,255,0)
position object x+1,rnd(99),0.5,rnd(99)
scale object x+1, 2000, 2000, 2000
next x
make object plain 6,1000,1000
xrotate object 6,90
color object 6,rgb(128,64,0)
set object emissive 6,rgb(128,64,0)
position object 6,50,0,50
`Variables
speed#=10
e_speed#=speed#-2.0
arma= 20 //gun
bala=21 //bullet
dumy=3 //dumy
`foor
make object box 111,3000,1,3000
texture object 111,1
scale object texture 111,3,3
`gun
make object cylinder arma,1
scale object arma,100,1200,100
xrotate object arma,90
fix object pivot arma
`bullet
make object box bala,1,1,20:color object bala,rgb(200,0,0):hide object bala
`dumy
make object sphere 333,30
position object 333,600,20,600
do `************ MAIN BUCLE *************************************************
for x=0 to 4
px#=object position x(dogs(x).object)
pz#=object position z(dogs(x).object)
tire(x)
if dogs(x).state=1
dogs(dog).speed=0.5
dogs(x).desx=object position x(7)
dogs(x).desy=object position y(7)
dogs(x).desz=object position z(7)
movedog(x)
if px# > dogs(x).desx-20.5 and px# < dogs(x).desx+20.5 and pz# > dogs(x).desz-20.5 and pz# < dogs(x).desz+20.5 then inc dogs(x).eat,20+rnd(40) : dogs(x).state=4
endif
if dogs(x).state=2
dogs(dog).speed=0.5
dogs(x).desx=object position x(80)
dogs(x).desy=object position y(80)
dogs(x).desz=object position z(80)
movedog(x)
if px# > dogs(x).desx-2.5 and px# < dogs(x).desx+2.5 and pz# > dogs(x).desz-2.5 and pz# < dogs(x).desz+2.5 then inc dogs(x).drink,20+rnd(30) : dogs(x).state=4
endif
if dogs(x).state=3
position object dogs(x).object,px#,0,pz#
dogs(x).sleepeness = dogs(x).sleepeness+0.2
if dogs(x).sleepeness > 90 then dogs(x).state=4
endif
if dogs(x).state=4
dogs(x).speed=0.2
if idletime > 1 or px# > dogs(x).desx-2.5 and px# < dogs(x).desx+2.5 and pz# > dogs(x).desz-2.5 and pz# < dogs(x).desz+2.5
dogs(x).desx=rnd(100)
dogs(x).desy=0.5
dogs(x).desz=rnd(100)
t=timer()
endif
idletime=(timer()-t)/1000
movedog(x)
endif
if dogs(x).eat < 40 and dogs(x).state=4 then dogs(x).state=1
if dogs(x).drink < 50 and dogs(x).state=4 then dogs(x).state=2
if dogs(x).sleepeness < 30 and dogs(x).state=4 then dogs(x).state=3
next x
control camera using arrowkeys 0,2,1
gosub _controla_camara
gosub bala
if object collision(bala,dumy)=1 then position object dumy,300+rnd(1000),10,300+rnd(1000)
sync
loop
_controla_camara:
rem UPKEY DOWNKEY ARROWS
if upkey()=1 then x#=newxvalue(x#,a#,1) : z#=newzvalue(z#,a#,1)
if downkey()=1 then x#=newxvalue(x#,a#,-1) : z#=newzvalue(z#,a#,-1)
`slide left
if leftkey()=1 THEN x#=NEWXVALUE(x#,a#-90,1):z#=NEWZVALUE(z#,a#-90,1)
`slide right
if rightkey()=1 THEN x#=NEWXVALUE(x#,a#-90,-1): z#=NEWZVALUE(z#,a#-90,-1)
`camera rotations
if cam#<=290 and cam#>180 then cam#=290
if cam#>=70 and cam#<180 then cam#=70
a#=wrapvalue(a#+mousemovex()/2)
cam#=wrapvalue(cam#+mousemovey()/2)
rotate camera cam#,a#,0 //camera rotations
rotate object arma,cam#,a#,0 //gun rotations
//positioning camera gun and bullet
position camera x#,600,z#
position object arma,x#,600,z#
move object arma,-5
position object bala,x#,600,z#
move object arma,15
move object right arma,3
move object down arma,3
move object bala,15
move object right bala,3
move object down bala,3
return
bala:
set cursor 310,235:ink rgb(255,0,0),0
print " +"
`-------------------------------------------------------------
`bullet start in gun positions
if dispara=0
set object to object orientation bala,arma
endif
if mouseclick() and dispara=0
dispara=1
show object bala
endif
if dispara=1
la=la+10
run=run+1
move object bala,la
endif
if dispara=1
la=la+12
run=run+1
move object 2,la
endif
if dispara=1
la=la+11
run=run+1
move object 3,la
endif
if run>200
run=0
la=0
dispara=0
hide object bala
endif
return
function tire(dog)
dogs(dog).eat = dogs(dog).eat-0.01
dogs(dog).drink = dogs(dog).drink-0.01
dogs(dog).sleepeness = dogs(dog).sleepeness-0.01
endfunction
function movedog(dog)
point object dogs(dog).object,dogs(dog).desx,dogs(dog).desy,dogs(dog).desz
move object dogs(dog).object,dogs(dog).speed
endfunction
Hey look at that!