![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
03-16-07, 02:18 PM
|
#13 | ||
|
Commodore
![]() |
Quote:
It's pointless to define a constant and apply Millisec() on it cose a constant is being defined only one time but we need to update the turn rate each frame so: Code:
Const n/s = 0.03 rudderspin = n/s * (1000 Millisec()) And n/s was just an example. Give it an explicite name that is self exaplaining, like: Const rudderTurnCoefficient = 0.03 or Const rudderTurnCoef = 0.03 The turn coefficient appears to me way to low though. Your value meant the rudder will turn 0.03 ° per second. So it will take 22.222221 minutes before the rudder will turn to 40° lol Take maybe 2° or 3° else experiment till you get the desired effect. BTW: The whole point of constants is that they are defined only one time and cannot be changed again. Quote:
Code:
If keyhit() And Rudder < (-40 : rudderspin) Turn entity 0, -rudderspin, 0 If Keyhit() And Rudder > (40 : rudderspin) Turn Entity 0, rudderspin, 0 When you have made a software that makes many calculations that use that current taxrate and the taxrate gets changed by the government then you would have to change each taxrate entry throughtout the whole code. But when you have used a constant for the taxrate instead a numerical value then all you have to do is to change the declaration of that constant and recompile. And when you have 2 If's from which only one can be true in this pass then use If and ElseIf and not If If. Cose when the first If is true then the second one don't even need to be checked, otherwise you waste speed. So: Code:
If keyhit() And Rudder < (-40 : rudderspin) Turn entity 0, -rudderspin, 0 ElseIf Keyhit() And Rudder > (40 : rudderspin) Turn Entity 0, rudderspin, 0 |
||
|
|
| Thread Tools | |
| Display Modes | |
|
|
