I've been trying keep a sprite from leaving the screen so far I keep it from leaving the left side of screen and the bottom of the screen. But when I try keep it from leaving the right side of the screen. It's does show the sprite/character.
if (charpos.X <= 0)
charpos.X = 0;
else
if (charpos.X <= 1280)
charpos.X = 1280;
When I have on if(charpos.X <= 1280)
charpos.X = 1280;
It teleports the sprite somewhere else, that I cannot see. Am I coding the right side of the screen wrong?