Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,213 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[newton]about accleration #97023
11/01/06 18:56
11/01/06 18:56
Joined: Aug 2005
Posts: 176
Latvia
HackerL Offline OP
Member
HackerL  Offline OP
Member

Joined: Aug 2005
Posts: 176
Latvia
Ok, i have tried to get that my car wount stop, when i release my accleration button. I have made NO progress! I know, i am not too good with c++, i prefer turbo pascal :O!

Code:
 		if(key_cuu)
{
my.carEngineTorque = my.car_maxToque * 1.0;
else
{
my.carEngineTorque = -0.3;
}
}




Now i am working on game NISSAN CHALLENGE! My home page is http://raivucis.ilva.lv
Re: [newton]about accleration [Re: HackerL] #97024
11/01/06 23:27
11/01/06 23:27
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Code:

my.carEngineTorque = 0;
my.carSteerTorque = 0;
if (key_cul || key_a) {
my.carSteerTorque = 1.0;
}
if (key_cur || key_d) {
my.carSteerTorque = -1.0;
}
if (key_cuu || key_w) {
my.carEngineTorque = my.car_maxTorque; //*1.0 does not modify value
}
if (key_cud || key_s) {
my.carEngineTorque = -my.car_maxTorque * 0.5;
}



Re: [newton]about accleration [Re: testDummy] #97025
11/02/06 19:38
11/02/06 19:38
Joined: Aug 2005
Posts: 176
Latvia
HackerL Offline OP
Member
HackerL  Offline OP
Member

Joined: Aug 2005
Posts: 176
Latvia
it is an tip?


Now i am working on game NISSAN CHALLENGE! My home page is http://raivucis.ilva.lv
Re: [newton]about accleration [Re: HackerL] #97026
11/02/06 20:24
11/02/06 20:24
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Quote:

it is an tip?



Quoted HackerL.
I can't interpret that.
In Newton, if you use the right script functions that are included for 'Newton cars', and setup 'input' values correctly, acceleration and deacceleration should be handled by Newton nearly automatically. If you press the forward key the car should gradually approach top speed and then remain there while the forward key is pressed. If you release the forward key, the car's speed should gradually decrease.

If you setup everything correctly or if just use the 'default setup', the car shouldn't just immediately stop when no key is pressed.

You probably don't want to set my.carEngineTorque = -0.3 when the forward key isn't pressed because the car will probably eventually start going backwards when the user isn't pressing a key. Essentially, if you just reset my.carEngineTorque to 0, and no key is pressed the car should probably just gradually slow down. For the most part, you probably don't need to 'muck' with acceleration directly.

C-Script is not C++.

Re: [newton]about accleration [Re: testDummy] #97027
11/02/06 21:17
11/02/06 21:17
Joined: Aug 2005
Posts: 176
Latvia
HackerL Offline OP
Member
HackerL  Offline OP
Member

Joined: Aug 2005
Posts: 176
Latvia
So ia have tried some other sing, and yes you are right about the part , when my.carEngineTorque is 0,0, my car is starting to go backwards, can you fix this script!?

Code:
  		// read wheel controls
if(key_cul)
{
my.carSteerTorque = 1.0;
}
if(key_cur)
{
my.carSteerTorque = -1.0;
}
if(key_cuu)
{
my.carEngineTorque = my.car_maxToque;
}
else
{
my.carEngineTorque = -60.0; //the car speed is decreasing
}
if(key_cud)
{
my.carEngineTorque = -my.car_maxToque * 0.5;
}
if(key_shift)
{
my.carEngineTorque = my.car_maxToque * 5.0;
}
wait(1);
}
}




Now i am working on game NISSAN CHALLENGE! My home page is http://raivucis.ilva.lv
Re: [newton]about accleration [Re: HackerL] #97028
11/02/06 22:04
11/02/06 22:04
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
It seems I might have wasted some of my time writing my last post in this thread.
Code:

/*
Notes:
arrow keys left/right to steer
up arrow key to move forward
down arrow key to move backward slower than moving forward
shift + up/down arrow key to move forward/backward faster
*/
//reset the torque values to 0
//torque values will be 0 if no key is pressed
//the car 'coasts' if no key is pressed
my.carEngineTorque = 0;
my.carSteerTorque = 0;
//...
if (key_cul) {
my.carSteerTorque = 1.0;
}
if (key_cur) {
my.carSteerTorque = -1.0;
}
if (key_cuu) {
my.carEngineTorque = my.car_maxToque;
} /* else {
my.carEngineTorque = -60.0; // NO! You don't need to do this.
} */
if (key_cud) {
my.carEngineTorque = -my.car_maxToque * 0.5; //only half-speed in reverse
}
if (key_shift) {
//'turbo' will be applied in reverse or forward, but not otherwise
my.carEngineTorque = my.carEngineTorque * 5;
}
//...
wait(1);


Newton might be considered an 'intermediate topic' for users that might have reached an 'intermediate' skill level.
If you are going to use Newton, you might try to study the 'example' scripts included with Newton thoroughly.

Last edited by testDummy; 11/02/06 22:07.
Re: [newton]about accleration [Re: testDummy] #97029
11/02/06 22:16
11/02/06 22:16
Joined: Aug 2005
Posts: 176
Latvia
HackerL Offline OP
Member
HackerL  Offline OP
Member

Joined: Aug 2005
Posts: 176
Latvia
i have settings for newton vehicle orginal, and i hate when i release accleration key, and my car stops immediatly, and when it does, i can't steer any more!

What i wrote, with script i wanted to get -

When accleration button is released, then my current speed decreasing, when my current speed is 0,0 then decreasing process should break or stop! Can you do that, because my c++ skills isnt impresive


Now i am working on game NISSAN CHALLENGE! My home page is http://raivucis.ilva.lv
Re: [newton]about accleration [Re: HackerL] #97030
11/03/06 05:20
11/03/06 05:20
Joined: Apr 2005
Posts: 95
San Francisco
TheStonerunner Offline
Junior Member
TheStonerunner  Offline
Junior Member

Joined: Apr 2005
Posts: 95
San Francisco
I had the same issue with something similar. What you want, rather than setting it to = -0.3 is

whatever you're trying to decrease -= 0.3;

that decreases it a bit at a time. You might also want to factor in some other variables, so that the decrease in speed is more realistic. But that's how you bring it down a bit at a time, rather than all at once.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1