Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to change comera position with no idea what the co-ords are

Author
Message
Jasonorc
16
Years of Service
User Offline
Joined: 29th Apr 2008
Location: Turn around...
Posted: 23rd May 2009 22:50
Ok, so I have...this code

Rem ***** Included Source File *****
` fps sword and shield weapon demo
` setup
sync on: sync rate 0
` make world
hide mouse
make matrix 1,1000,1000,10,10
` make shield and sword
make object box 10,2,20,2
make mesh from object 1,10:delete object 10
make object cube 10,5:add limb 10,1,1:offset limb 10,1,7,-7,15
add limb 10,2,1:offset limb 10,2,0,10,0
link limb 10,0,1:link limb 10,1,2
hide limb 10,1
delete mesh 1
load object "media\Template Body 1.x",60
position object 60, 70, 10, 50
rotate object 60, 90, 0, 0
scale object 60, 300, 300, 300
load object "media\house.3ds", 75
scale object 75,2000, 2000, 2000
position object 75, 200, 0, 30
load object "media\house.3ds", 76


` shield
make object plain 11,12,20
make mesh from object 1,11:delete object 11
make object cube 11,10:add limb 11,1,1
offset limb 11,1,-7,-16,15
set object cull 11,0
link limb 11,0,1
hide limb 10,0:hide limb 11,0
do

set cursor 0,0
print scancode()
` move and camera
vx#=mousemovex():vy#=mousemovey()
ax#=wrapvalue(ax#+vy#)
ay#=wrapvalue(ay#+vx#)
cay#=curveangle(ay#,camera angle y(),20)
cax#=curveangle(ax#,camera angle x(),20)
` rotate camera
rotate camera cax#,cay#,0
` move
ox#=x#:oz#=z#:move=0
if keystate(17)=1 then x#=newxvalue(x#,cay#,d#):z#=newzvalue(z#,cay#,d#):move=1
if keystate(31)=1 then x#=newxvalue(x#,cay#+180,d#):z#=newzvalue(z#,cay#+180,d#):move=1
if keystate(32)=1 then x#=newxvalue(x#,cay#+90,d#):z#=newzvalue(z#,cay#+90,d#):move=1
if keystate(30)=1 then x#=newxvalue(x#,cay#-90,d#):z#=newzvalue(z#,cay#-90,d#):move=1
d#=0.3
` limit
if move>0
walk#=walk#+d#*4
endif
` position
y#=curvevalue(60,y#,20)
if controlkey()=1 then y#=curvevalue(15,y#,20):d#=0.5
position camera x#,y#+sin(walk#)*3,z#
` sword position
position object 10,camera position x(),camera position y(),camera position z()
` sword fighting
if mouseclick()=1
if swingx#=0 then swingx#=1
lax#=wrapvalue(limb angle x(10,1)-90)
if lax#>180 then lax#=lax#-360
if lax#<-15 or lax#>15
if lax#<0 then swingx#=swingx#+0.03
if lax#>0 then swingx#=swingx#-0.03
else
swingx#=swingx#/1.01
endif
lay#=wrapvalue(limb angle y(10,1))
if lay#>180 then lay#=lay#-360
if lay#<-15 or lay#>15
if lay#<0 then swingy#=swingy#+0.03
if lay#>0 then swingy#=swingy#-0.03
else
swingy#=swingy#/1.01
endif
swordax#=(swordax#-vy#)+swingx#
sworday#=(sworday#-vx#)+swingy#
else
swordax#=curveangle(0,limb angle x(10,1),20)
sworday#=0
swingy#=0:swingx#=0
endif
say#=curveangle(cay#,say#,10)
sax#=curveangle(cax#,sax#,10)
rotate limb 10,0,sax#,say#,0
rotate limb 10,1,swordax#,sworday#,0
` shield
position object 11,camera position x(),camera position y(),camera position z()
rotate limb 11,0,sax#,say#,0
` shielded
if mouseclick()=2
ofx#=curvevalue(-2,ofx#,10)
ofy#=curvevalue(-10,ofy#,10)
ofz#=curvevalue(7,ofz#,10)
d#=d#/2
else
ofx#=curvevalue(-7,ofx#,10)
ofy#=curvevalue(-16,ofy#,10)
ofz#=curvevalue(15,ofz#,10)
endif
offset limb 11,1,ofx#,ofy#,ofz#
sync
loop


[\code]

And now how do I make the camera switch to a more zelda-ish/diablo style camera position, I know how to do it with normal coordinates, but I'm using a tutorial script, and the XYZ in this totally threw me off, any ideas?

My site: www.skyknight.co.uk
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 23rd May 2009 23:44
well, you could just place the camera above the player

change this line of code:

position camera x#,y#+sin(walk#)*3,z#

to

position camera Player Position X,Player Position Y+20,Player Position Z

i'm nut sure if the camera position is important to this code, but it might screw the code a little, so you have to work around that

(\__/)
(O.o )
(> < ) This is Bunny. Copy Bunny into your signature to help him on his way to world domination!
Jasonorc
16
Years of Service
User Offline
Joined: 29th Apr 2008
Location: Turn around...
Posted: 23rd May 2009 23:49
But I don't have player position defines as anything, I can't use then without definign them first, what should I define them as though?

My site: www.skyknight.co.uk
Vathelokai
15
Years of Service
User Offline
Joined: 3rd May 2009
Location:
Posted: 24th May 2009 01:08
You can use object position x() and put any object number attached to the player in the ().

Or at the begining of the loop have some variable that updates to ...
players_current_position_x = object position x(100)

Login to post a reply

Server time is: 2024-09-28 06:20:26
Your offset time is: 2024-09-28 06:20:26