Quote: "Nice addition though Chafari "
Thanks....I just try to help.
To convert this piece of code 3D person to first person just add the camera:
position camera object position x(1),object position y(1),object position z(1)
Have a look again to the code....I have rem the camera line and added a new line commands.
Rem ***** Main Source File *****
// set a refresh rate
sync on : sync rate 60
// get random numbers each time
randomize timer()
// make the player
make object sphere 1,30
// make scenery
for n = 2 to 6
make object cube n,100
position object n, rnd(600), 0, rnd(400)
next
// camera position
camx as float = 0.0
camy as float = 30.0
camz as float = -10.0
// distance between object and camera
distance as float = 70.0
// the angle of the object
angle as float = 0.0
// starting camera pitch
pitch=20
// main loop
do
// move the object
if upkey()=1 then move object 1, 1.0
if downkey()=1 then move object 1,-1.0
// rotate the object
if rightkey()=1 then angle = wrapvalue(angle + 1.0)
if leftkey()=1 then angle = wrapvalue(angle - 1.0)
if inkey$()="w" then pitch=pitch+1.0
if inkey$()="s" then pitch=pitch-1.0
yrotate object 1, angle
// poisition the camera according the the player's coordinates and rotation
camx = (-sin(angle)*distance)+object position x(1)
camz = (-cos(angle)*distance)+object position z(1)
rem position camera camx, camy+pitch, camz
position camera object position x(1),object position y(1),object position z(1)
rotate camera pitch,angle,0
// refresh
sync
loop
I'm not a grumpy grandpa