Computer Science Canada Help with collison detection |
Author: | Abbas_M [ Sat Jan 16, 2010 5:56 pm ] | ||
Post subject: | Help with collison detection | ||
What is it you are trying to achieve? Im trying to figure out how to get collision detection between my images working. What is the problem you are having? I read the collision detection tutorial for rectangles and it says that if you have an image you only know x1 and y1 of the image and to find x2 and y2 simply add Pic.Width to x1 value and Pic.Height to y1 value but it dont understand what it means by that. The two objects i need colision detection between is a spaceship and a zombie. Describe what you have tried to solve this problem Read the tutorial a few times and tried on code but i fail. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.1.1 I also need to find the values of the zombie that will be randomly generated. the tutorial doesnt say how to do that. |
Author: | TheGuardian001 [ Sat Jan 16, 2010 6:08 pm ] | ||
Post subject: | Re: Help with collison detection | ||
Abbas_M wrote: add Pic.Width to x1 value and Pic.Height to y1 value but it dont understand what it means by that. You don't understand what they mean by add the two values together? Pic.Width is a command built into the turing language, as is Pic.Height. They return the width and height of an image, respectively.
If you add the value given by Pic.Width to x, you get the x coordinate of the right hand side of the box, and if you add Pic.Height to the y value, you get the y coordinate of the top of the box. Combine those two into a single coordinate, and you have the coordinates of the top right hand corner. |
Author: | Abbas_M [ Sat Jan 16, 2010 6:21 pm ] |
Post subject: | Re: Help with collison detection |
ok i understand thank you very much. |