Quote: " Here's the mousewheel zoom.
+ Code Snippet
sync on
sync rate 0
hide mouse
autocam off
make object sphere 1,16
position object 1,0,0,32
MouseZLast = 0
MouseZNow = 0
`DBC Default camera FOV
FOV# = 3.14/2.905
while escapekey() = 0
set cursor 0,0
MouseZNow = mousemovez()
if MouseZNow <> MouseZLast
if MouseZNow > MouseZLast
`Mousewheel down, zoom out
FOV# = FOV# - 0.02
else
if MouseZNow < MouseZLast
`Mousewheel up, zoom in
FOV# = FOV# + 0.02
endif
endif
`zoom out
if FOV# > 2.905 then FOV# = 2.905
`zoom in
if FOV# < 0.314 then FOV# = 0.314
MouseZLast = MouseZNow
`set the FOV for zooming
set camera fov FOV#
endif
sync
endwhile
I suggest using 'set camera fov' for zooming instead of 'move camera'.
You have to compare the current value of mousemovez() with the last value of mousemovez() and see if it is greater or less. Print the value of MouseZNow and MouseZLast and you'll see why.
"
Ok thanks, your code worked, but I found that the Fov commands were stretching objects, so I changed it to a simple move camera command. However, I have encountered a problem. I can now scroll in and out with the mouse, but I can no longer move the camera left, right, up, or down. Any ideas why? Here is my code.....
`Vital project stats
`Name: Worlds at war
`Started: wednesday, December 22, 2004
`Genre: Strategy
`Author: Jerad Laxson
`Programmer: Jerad Laxson
`Artist: Jerad Laxson
`PLANETARY ARRAYS
dim earth(0)
dim venus(0)
dim mercury(0)
dim jupider(0)
dim mars(0)
dim saturn(0)
dim neptune(0)
dim uranus(0)
dim pluto(0)
`camera variables!
x#=0
y#=0
z#=-100
`Planetary variabes 0=neutral, 1=player, 2=enemy
earth(0)=1
venus(0)=0
mercury(0)=0
jupider(0)=0
mars(0)=0
saturn(0)=0
neptune(0)=0
uranus(0)=0
pluto(0)=0
`make planets
mercury=1
make object sphere mercury,25
color object mercury,RGB(155,50,50)
set object collision on mercury
position object mercury,-180,10,0
venus=2
make object sphere venus,30
color object venus,RGB(100,90,90)
set object collision on venus
position object venus, -90,-80,0
earth=3
make object sphere earth, 30
color object earth,RGB(0,255,0)
set object collision on earth
position object earth,0,0,0
mars=4
make object sphere mars, 20
color object mars,RGB(255,0,0)
set object collision on mars
position object mars,80,100,0
jupider=5
make object sphere jupider, 80
color object jupider, RGB(100,50,50)
set object collision on jupider
position object jupider, 150,0,0
`ZOOM
MouseZLast = 0
MouseZNow = 0
`DBC Default camera FOV
FOV# = 3.14/2.905
while escapekey() = 0
set cursor 0,0
MouseZNow = mousemovez()
if MouseZNow <> MouseZLast
if MouseZNow > MouseZLast
`Mousewheel down, zoom out
move camera -10
else
if MouseZNow < MouseZLast
`Mousewheel up, zoom in
move camera 10
endif
endif
`zoom out
if FOV# > 2.905 then FOV# = 2.905
`zoom in
if FOV# < 0.314 then FOV# = 0.314
MouseZLast = MouseZNow
`set the FOV for zooming
set camera fov FOV#
endif
sync
endwhile
`main loop!
sync on
sync rate 30
do
`Camera stuff!
position camera 0+x#,0+y#,0+z#
if rightkey()=1
x#=x#+1
endif
if leftkey()=1
x#=x#-1
endif
if upkey()=1
y#=y#+1
endif
if downkey()=1
y#=y#-1
endif
sync
loop
Guns arn't the problem, people are the problem, shoot all the people and guns arn't a problem anymore.