Cant figure out this coding

I am making a windows game project in C# and I am pretty new to coding. My program involves using the keyboard to move an object around the screen but I can not figure out one thing. How do I code it so my object does not go off the screen? As of right now I just have it displaying the object and have the object programmed to move with the arrow keys.

Last edited on
Test the objects position. If it's x-position is greater than the screen width, or less than 0 (it's off moved off the screen on the x-axis), adjust it accordingly. The same applies for the y-position.
Like i said I am new and don't know how to do that. The object on the screen is moveable using arrow keys so i'm not sure what to do
Topic archived. No new replies allowed.