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.

DarkBASIC Discussion / (total newbie) whats wrong with this code?

Author
Message
deathbringer
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 1st Mar 2003 00:03
do
if upkey()=1 then position object 1,ypos#,xpos#+0.1,0
if downkey()=1 then position object 1,ypos#,xpos#-0.1,0
if rightkey()=1 then position object 1,ypos#+0.1,xpos#,0
if leftkey()=1 then position object 1,ypos#-0.1,xpos#,0
sync
loop

I want the object to be moving smootly up, down,left and right, but when i press the key it just "jerks" in that direction and stops, and also doesnt go any further if you keep on pressing the same button, i couldnt find anything to say that this wouldnt work in any tutorials and that though..so, any advice? XD
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 1st Mar 2003 00:13
Try



I dont think this'll solve your speed problem, but it will solve moving only once.

Whatever I did I didn't do it!
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 1st Mar 2003 00:14
Also, I think you confused x# and y# when using position object.

Whatever I did I didn't do it!
deathbringer
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 1st Mar 2003 00:15
Ah, okay ^_^ thanks XD

deathbringer
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 1st Mar 2003 00:18
why does editing never work on forums anymore?

anyway, that code just gives me an unrecognised perameter error, but i see how its supposed to work XD *experiments*

Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 1st Mar 2003 00:24
I think Rich is working on the edit function.
Also, I also got confused between the x# and z# coordinates. This code actually works. Good luck



Whatever I did I didn't do it!
deathbringer
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 1st Mar 2003 00:27
XD, well that works, doesnt get the result i wanted though, but i can easily edit it XD

(i wanted the object, which is a space ship, to stay in the same z position but move up, down left and right to dodge incoming objects XD, ooh well *goes to edit*)

Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 1st Mar 2003 00:27
Rich! Please hurry up with the edit function!
I'm making a fool of myself

Ok, change y# in y#+0.01 and y#y#-0.01 to x#
x# moves sidewards
y# moves up and down
z# move forward and backward

Whatever I did I didn't do it!
deathbringer
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 1st Mar 2003 00:43
i know, i worked that out myself LOL
now im having fun with trying to prevent the player from flying off the screen altogether, oh well, i think i'll leave the "bug" of them getting stuck there in, to punish them for cheating LOL

Login to post a reply

Server time is: 2025-05-15 12:24:02
Your offset time is: 2025-05-15 12:24:02