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 / movement code help

Author
Message
Zokomoko
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 7th May 2004 12:44 Edited at: 7th May 2004 12:46
the movement is time based, but it isn't working correctly.
every about 1 second, it stop then continues moving the object.

please help, i don't know what's wrong with it.


1 is player object

EDIT: last section of the code was cut, so i add it

if acceleration#(i)>0 `if object is moving forwarf
if speed#(i)>topspeed#(i) then speed#(i)=topspeed#(i) `don't let object move faster than top speed
else
if speed#(i)<topspeed#(i) then speed#(i)=topspeed#(i)`don't let object move faster than top speed
endif
if object exist(i)=1 and type$(i)="ship" then move object i,speed#(i)*(abs(timer()/1000-speedtimer#(i)/1000)) `move object
speedtimer#(i)=timer() `reset time since last moved
next i
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th May 2004 14:21
haven't checked your logic, but if you are using speedtimer#, you should divide by 1000.0, not 1000. You may be getting integer answers where you expected reals.

BatVink
http://facepaint.me.uk/catalog/default.php AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
Zokomoko
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 7th May 2004 14:35
solved it.
i deleted all the accelerationtimer# and speedtimer# to the lowest section of the loop and it works.

Login to post a reply

Server time is: 2024-09-22 08:37:46
Your offset time is: 2024-09-22 08:37:46