View Single Post
Old 07-05-2008, 06:13 AM   #6 (permalink)
DiNoGames
zB Programmer
Jr. Member
 
DiNoGames's Avatar
 
Join Date: May 2008
Location: Bremen, germany
Posts: 454
Reputation: 248
Send a message via Skype™ to DiNoGames
Default

[quote=Rockman87;257171]
Code:
                personPos.Y += (int)((gamepadStatus.ThumbSticks.Left.Y * 5) * -1);
                if ((int)((gamepadStatus.ThumbSticks.Left.Y * 5) * -1) < 0)
                {
.
.
.
I think in your code its not very important, but never do the same calculations more than once if not needed.
Store the value instead.
In addition, why do you add a value to personPos.Y and negate it by multiplying with -1? You could better subtract it from the beginning. It would be the same...

Applying these things, the code should rather look like:

Code:
    int TmpValue =  (int)(gamepadStatus.ThumbSticks.Left.Y * 5);           
    personPos.Y -= TmpValue;
    if (TmpValue < 0)
    {
.
.
.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.







DiNoGames is offline   Reply With Quote