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.

Code Snippets / Directional movements

Author
Message
Mike Inel
21
Years of Service
User Offline
Joined: 14th Feb 2003
Location: Sa upuan ko po...
Posted: 12th Apr 2003 13:15
I finally got my 2 days problem done!!!
This code makes the object move to any direction you want

Sync on
sync rate 30

make object cube 1,1
do

x#=object position x(1)
z#=object position z(1)
a#=object angle y(1)

if upkey()=1
zn#=z#+1
endif

if downkey()=1
zn#=z#-1
endif

if leftkey()=1
xn#=x#-1
endif

if rightkey()=1
xn#=x#+1
endif

position object 1,xn#,0,zn#

if zn#z# or xn#x# or zn#z# and xn#x#
point object 1,x#,0,z#
endif

an#=object angle y(1)

ad#=curveangle(an#,a#,4)
yrotate object 1,ad#

sync
loop
.....What?
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Apr 2003 00:33
have you actually tried running this?
if zn#z# or xn#x# or zn#z# and xn#x#
???? what's that suppose to mean?
Here's some code for a first person camera, using the mouse and arrow keys to move and look around on a matrix. You can even jump. What the heck, I'll write a firing routine as well before posting.

Login to post a reply

Server time is: 2024-03-28 12:12:29
Your offset time is: 2024-03-28 12:12:29