Computer Science Canada Keeping a drawn object inside the max of screen |
Author: | Robotkubo [ Thu Feb 25, 2016 10:15 am ] | ||
Post subject: | Keeping a drawn object inside the max of screen | ||
Been working on a project that makes a ball grow and get smaller with the press of a '1' and '2' and can move with the arrow keys, I got all that working but I cant get it to stay inside the max of the screen, I tried some code but if someone could point me in the right direction that would be great!
Please specify what version of Turing you are using <Answer Here> |
Author: | Insectoid [ Thu Feb 25, 2016 1:24 pm ] |
Post subject: | RE:Keeping a drawn object inside the max of screen |
You need to compare the coordinates of the ball to the coordinates of the bounds of the screen. Try drawing it out on paper. Draw the ball in a few different spots (inside the walls, outside the walls, adjacent to the walls, etc) and label the coordinates of each one. Try to figure out how they relate to those of the walls and then create rules to decide where the ball is based on what you learned. |