Hello, I have the following statement in my code:
if( spriteSpeed > 0 ) {
if( spriteSpeed > spriteMaxSpeed )
{
spriteSpeed = spriteMaxSpeed;
}
} else if ( spriteSpeed < 0 ) {
if( spriteSpeed < -( spriteMaxSpeed ))
{
spriteSpeed = -( spriteMaxSpeed );
}
}
It works fine, but my question is whether or not there’s a more ‘professional’ way to rewrite this. It seems inefficient to treat the positive and negative signage separately. Thanks so much for your help!