Unfortunately it is not just AppGameKit that has this issue C has been having the same problems since it started decades ago. Basically always use the right variable for the maximum number you wish to store in it
Integers for whole numbers, floats for floating point calculations. C++ introduced double and long long for huge numbers but the trade off is space a standard int is four bytes but a long long is eight as is a double.
If your making any sort of program ALWAYS know limits of variables this way you won't be scratching your head when your unsigned char won't go beyond 0 to 255