>>23480
>a hundred fucking global variables and repeated calls
anon, have you ever considered using structs and arrays
ie
GameObject pwcm;
GameObject PCstep;
GameObject PCbase;
GameObject PCbase2;
GameObject PCbase3;
GameObject Indicator;
GameObject PChar;
GameObject PCA;
GameObject PCam;
GameObject jumptext;
GameObject playerMC;
GameObject tgo;
GameObject PAxis2;
GameObject Axis2Rotation;
GameObject Axis2baserotation;
GameObject Slide_PS;
GameObject OBwalljump;
and instead just storing that as an array/dict, so you can loop through it instead of stupid shit like 20 handwritten find() calls in your start() function
also what
if (leftStickAngle2 > 316 || leftStickAngle2 < 44 || leftStickAngle2 > 46 && leftStickAngle2 < 134 || leftStickAngle2 > 136 && leftStickAngle2 < 224 || leftStickAngle2 > 226 && leftStickAngle2 < 314) {
break this shit up and make it readable god damn
if (leftStickAngle2 > 316 ||
leftStickAngle2 < 44 ||
leftStickAngle2 > 46 && leftStickAngle2 < 134 ||
leftStickAngle2 > 136 && leftStickAngle2 < 224 ||
leftStickAngle2 > 226 && leftStickAngle2 < 314) {
and why the fuck are you putting so many newlines between everything, it makes it impossible to follow the structure of the code
if ( allowjump == true && grounded == true && distanceToGround > gdval2 && groundhitbool == true ){
anon do we need to bring out the cs grad meme
conditionals evaluate to true/false
a boolean evaluates to true/false
thus
if (allowjump) is already a check for if allowjump is true. Writing it explicitly is just line noise
finally
how much of that massive fucking global declaration actually needs to be global
if it's local to some particular calculation and doesn't need to be stored permanently, then group it with the calculation. ie declare a function.
Anon, when you're copying and pasting 50 lines to modify an algorithm, you've fucked up. You should be copying like 3-5 lines, because you've grouped all the major actions into separate functions
and shit like this
jt.text = "rvmag2 " + rvMag2.ToString ()
+ "\ntan angle 2" + stickAngleTan2.ToString ()
+ "\nbase run speed2:" + baserunspeed2.ToString ()
+ "\ngrounded " + grounded.ToString ()
//+ "\ny velocity " + playerfallvelocity.ToString ()
+ "\nvelmag " + velMag.ToString ()
+ "\nvelmag2 " + velMag2.ToString ()
+ "\n jumpintervaltimer" + jumpintervaltimer.ToString()
+ "\nstickangle2 " + leftStickAngle2.ToString ()
+ "\nmovetime " + movingtimer.ToString ()
should just be using a string formatting method, whatever the hell C# has for it
and
if ( stickmoving == true ){
transform.rotation = Quaternion.FromToRotation( Vector3.up, groundhit.normal )* Quaternion.AngleAxis( -xrotation3, Vector3.up ) * Quaternion.AngleAxis( leftStickAngle2 , Vector3.up );
} else {
transform.rotation = Quaternion.FromToRotation( Vector3.up, groundhit.normal )* Quaternion.AngleAxis( -xrotation2, Vector3.up ) * Quaternion.AngleAxis( leftStickAngle2 , Vector3.up );
should be
xrotate;
if stickmoving {
xrotate = -xrotation3;
}
else {
xrotate = -xrotation2;
}
transform.rotation = Quaternion.FromToRotation( Vector3.up, groundhit.normal )* Quaternion.AngleAxis( xrotate, Vector3.up ) * Quaternion.AngleAxis( leftStickAngle2 , Vector3.up );
And thus it actually becomes clear what the fuck you're changing