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 / player movement,inc z

Author
Message
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 4th Feb 2009 11:51
hi,ive tried coding my program to inc movement along the z axis when the up key is pressed,which im not sure how best to do this,could you add to my program to include movement along the z axis.
many thanks.

hide mouse
rem loading
rem select font
set text font "arial" : set text size 16
set text to bold : set text transparent

rem Loading prompt
center text screen width()/2,SCREEN HEIGHT()/2,"LOADING"
WAIT 3000
CLS
load object "Waitingworks4.x",1
load object "Waitingworks5walk12.x",2
hide object 2
position object 2, 0, 0, 0
xrotate object 2,90
position object 1, 0, 0, 0
xrotate object 1,90




REM START LOOP


DO

IF UPKEY() = 0
HIDE OBJECT 2
SHOW OBJECT 1
set object speed 1,5
LOOP object 1,1,231
ENDIF


if upkey() = 1
hide object 1
stop object 1
set object frame 1,0
rem xxxxxxxxxxxxxxxxxxxx
rem move object forward 1
rem xxxxxxxxxxxxxxxxxxxx

show object 2
set object speed 2,5
LOOP object 2,1,21
ENDIF


Rem Left and Right

If Leftkey()=1 then aY# = Wrapvalue(aY#+1)

If Rightkey()=1 then aY# = Wrapvalue(aY#-1)

rem rotate the sphere
Yrotate object 1,aY#
yrotate object 2,ay#

LOOP
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 4th Feb 2009 12:35 Edited at: 4th Feb 2009 12:36
You should really use the [ code ] <text> [ /code ] tags when inserting more than a few lines of code in your posts.

Anyhow, there is a command named newZValue that you should be able to use like so:

(Where stepValue is the distance to move from the current position).

"We know some things about poodles, for example that they are alive, they can bark, they eat meat..."
- Extract from Objects first with Java.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 4th Feb 2009 12:46
Thanks but my object still stays in the same spot.The code hasnt moved him which I would like to happen.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 4th Feb 2009 13:09 Edited at: 4th Feb 2009 13:11
I put in this after your comment; it works for me?


Edit: If your model is large, you might have to increase the stepValue or just hold the key down for a while to notice any movement. If on the other hand, it is gone when you release the button, you have moved your object too far away

"We know some things about poodles, for example that they are alive, they can bark, they eat meat..."
- Extract from Objects first with Java.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 4th Feb 2009 13:15
Many thanks,I added your code but the model disappears when up key is pressed and still remains fixed.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 4th Feb 2009 14:46
Still need some help guys.

Login to post a reply

Server time is: 2024-09-28 02:34:04
Your offset time is: 2024-09-28 02:34:04