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 / Car Racing Game... Help!

Author
Message
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 10th Jun 2004 04:48 Edited at: 10th Jun 2004 04:49
I wanted to make a car racing game. So, i downloaded a tutoial. I tried making something and it doesn't work. Can someone please help me with this code! Tnx. Heres the code:


The speed is ALL messed up!
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 11th Jun 2004 10:16
hey,
i fixed the code....there were some weird lines in it, so here it is.....

now, what i fixed was:
1) 1 slowed the speeds way down....moveing at a constant rate of 10 is very fast....
2) you were operating your camera angle on the objects x angle....rather strange, so i changed it to its y angle....
3) i changed your speed inc and dec....i dont remember why, but i did
4) moveing the object speed seemed strange, so i changed it to an x#/z# repositioning system using newxvalue and newzvalue



thats it.....i hope you like the new code

cheers,
Bish

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 12th Jun 2004 19:49
Yay,Tnx!
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 12th Jun 2004 19:50
(yah... I know there was some weird code in it. I was gona delete all those stupid things) lol
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 12th Jun 2004 19:52 Edited at: 12th Jun 2004 19:54
If you want... If i ever work on the code and make it into a game, im gona put ur name in the credits for helping! Tnx!
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 12th Jun 2004 19:53
LOL... im stuck again. I think the car is excellerating to fast. How can I fix that?
Hepy
20
Years of Service
User Offline
Joined: 16th Apr 2004
Location: United Kingdom
Posted: 12th Jun 2004 20:00
Change the Excellspeed to a lower value,
sorry if i didn't help,
Hepy

Hepy
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 12th Jun 2004 20:05
Tnx. But i tried that and it still excelled WAY to fast.
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 16th Jun 2004 02:13 Edited at: 16th Jun 2004 02:14
Any other ways? Tnx anyway, but that code didnt really help. ( ^ ^ ^ )
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 16th Jun 2004 22:39
Okay, maybe I have a suggestion here...

It occurs to me that the reason you think the car is accelerating too fast is because the main loop is quite short, meaning that the keyboard gets checks very often per second. So, I propose you try something like this;

If (UpKey()=1) and (Speed# < MaxSpeed#) and (timer() > (tim+200)) then speed#=speed#+.03 : tim = timer()

This way, the keyboard response will be slowed by the value of 200 ms per pass through the loop, thus slowing the acceration changes applied to your vehicle. Do the same to the other tests, and adjust the 200 to whaetever value feels right to you.

S.

Any truly great code should be indisguishable from magic.
Skier Demon
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 17th Jun 2004 06:51
THanks
Don Malone
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 17th Jun 2004 15:03 Edited at: 17th Jun 2004 15:03
Someone (I don't remember who) mentioned this as a way to reduce program overload and spped up the program but it may also be what you want.

Check the Frames per second your program is running (You can use an arbitrary number but I am thinking about using it on other computers also.)
Determine how often you will need to check your acceleration per second. Then only allow checks for the accel key every X number of loops instead of every loop. You can do it with an incrementing counter

start of program declare AccelFlag as integer and set it to 0

in your loop at the bottom probably increment it by one
When you reach your acceleration check say
Quote: "
if AccelFlag> 8
<Your code to check acceleration>
Accelflag=0 :::: It will get incremented to one at the end of your loop
end if
"


It is not as elegant as SandraD's code but just shows a more round about way to accomplish it.

Wasting CPU Cycles since the 286 was a hot machine.

Login to post a reply

Server time is: 2024-11-26 21:27:18
Your offset time is: 2024-11-26 21:27:18