Quote:
Originally Posted by Chad
I don't know what psuedo code is except that it's in plain language, no coding.
|
Exactly. You formulate each step of the code by plain language.
Quote:
is an example of psuedo code, but I really don't know how to put this in for my rudder adjustments
|
Uhh, you can't exaplain what your rudder is supposed to do in plain language, although you can even do this kinda in code ?
You kidden me, ain't you ?
Anyway i will give you an example:
Code:
If key(A) is pressed and rudder is > -40, turn rudder to prt by n°/s
else if key(D) is pressed and rudder is < 40, turn rudder to prt by n°/s
Simple eh ?
But why turn it for n°
per second ? becose when you not turn it vs time it will be turned by n°
each frame. This will have the side effect that the turnrate will always change according to the framerate which always fluctuates and is very different from system to system.
If you want to make sure that the rudder never turn more than 40°, cose in the example above it will stop to turn only when it's already
above the 40. It will be just a tiny little bit above it maybe not noticeable at all but if you want it to be 100% correct then you can express it like this:
Code:
If key(A) is pressed and rudder is > (-40 - n° * Millisec()), turn rudder to prt by n°/s
else if key(D) is pressed and rudder is < (40 - n° * Milisec()), turn rudder to prt by n°/s
More efficient would be to express it like this:
Code:
; The ammount the rudder is supposed to spin in this frame
rudderSpin = n°/s * Millisec() ; n°/s is the ammount the rudder should spin in a second. Milisec simple reduce this value depending on the frame rate so that the rudder always spin by the same ammount per second regardless of the framerate. For n°/s use a constant. Don't use numerical values in your code.
If key(A) is pressed and rudder is > (-40 - -rudderSpin), turn rudder to prt by -rudderSpin
else if key(D) is pressed and rudder is < (40 - rudderSpin), turn rudder to prt by rudderSpin
With such a simple code you don't need pseudo code but if you are still a beginner it might help alot.
Ok Chad now show me if you can transform this into code.