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 / help with moving left and right

Author
Message
Kivu_Rako
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 12th May 2004 19:22
okay i am creating a game, and i cannot get my main object to move left or right.
how could i do this
it is positioned at x#,y#,z# but when this happens:
"
if keystate(30)=1
x#=x#-10
endif
if keystate(32)=1
x#=x#+10
endif
"
it doesnt move. And yes positioning the object at x#,y#,z# is in the main loop
please help
probable easy too
thx


"geez, its probably a noobish mistake too!"
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 12th May 2004 20:29
sync on:sync rate 60
do
if leftkey()=1
x#=x#-10
endif
if rightkey()=1
x#=x#+10
endif
sync
loop

that should work

CURRENT PROJECT: RETRO PAC-MAN
Pixle Pusher
20
Years of Service
User Offline
Joined: 4th May 2004
Location: Monitor, Keyboard, Mouse. UK
Posted: 12th May 2004 20:34 Edited at: 12th May 2004 20:35
Nevermind
Kivu_Rako
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 13th May 2004 02:14
um... but i want to use the "a" and "d" keys
but besides that, your program is the exact same as mine, minus the sync:sync rate 60. And would that make the difference?

"geez, its probably a noobish mistake too!"
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 13th May 2004 03:23
yes you have to put "sync on" and "sync rate" at top of your code

CURRENT PROJECT: RETRO PAC-MAN
Kivu_Rako
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 16th May 2004 02:21
the sync rate command addition does not fix the problem
so i am clueless as to why the strafing will not work
plz help.

"geez, its probably a noobish mistake too!"
Social Disease
20
Years of Service
User Offline
Joined: 30th Sep 2003
Location: State of Confusion, beyond Denial...
Posted: 16th May 2004 08:08
You are moving an object or the camera?
If you are moving an object it couldn't be simpler!
Quote: "
MOVE OBJECT RIGHT
This command will move the object in a right direction relative to its forward facing angle, rather than an
absolute world direction.

SYNTAX
MOVE OBJECT RIGHT Object Number, Value
"


and

Quote: "
MOVE OBJECT LEFT
This command will move the object in a left direction relative to its forward facing angle, rather than an
absolute world direction.

SYNTAX
MOVE OBJECT LEFT Object Number, Value
"




Think Gad fro Spill Chock!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th May 2004 13:59
Post some code. That way we can see what the problem is rather than guess at it

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
bibz1st
21
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 16th May 2004 15:15
this works
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
if keystate(30)=1
x#=x#-10
endif
if keystate(32)=1
x#=x#+10
endif
position object 1,x#,y#,z#
Kivu_Rako
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 17th May 2004 16:47
when i say "MOVE OBJECT LEFT/RIGHT 1,10", it just says unrecognized parameter. So why wont that work?
?

"geez, its probably a noobish mistake too!"
Social Disease
20
Years of Service
User Offline
Joined: 30th Sep 2003
Location: State of Confusion, beyond Denial...
Posted: 18th May 2004 01:54
Dark Basic Classic or Dark Basic Pro?
In DBPro, that should work fine, provided you already have object 1 made.

Think Gad fro Spill Chock!
Kivu_Rako
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 18th May 2004 03:02
im using dbc.
so how would i strafe in dbc?
okay... so some code now...
well...
when i originally posted this problem, it was a much bigger program...
but now i started over, but i am having the same problem using This code.
also i had the same problem with the old code...
"Unrecognized parameter."

"geez, its probably a noobish mistake too!"
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 18th May 2004 03:18
did not read entire thread...but here goes....

just set teh variable "id" to whatever object you want to move


Formerly known as "DarkWing Duck"

Login to post a reply

Server time is: 2024-09-22 09:44:44
Your offset time is: 2024-09-22 09:44:44