c++ - Hello, i need to figure out how to change coordinates. not a GUI -
i using microsoft visual c++ express 2010 have variables: int x, represents position of video game character. (their y of course) program loops , each time changes x couple of places. must within 0-800. , when reaches 0 (which supposed edge of screen) rewinds.
i have figured out how change value every time program runs, how make sure keeps value in 0-800 range, , rewind when reaches position 0? , has own function outside of main entirely. thank you.
x = (x + 800) % 800;
this keep x
within (0..799)
. if need (0..800)
, replace 800
801
.
Comments
Post a Comment