Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with collison detection
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Abbas_M




PostPosted: 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)


Turing:

%I need to find the other two values of this image to continue on with the tutorial
Pic.Draw (ship, x, y, picMerge)

%the first two values are x and y because the space ship is going to be moving and not being still.


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.
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: 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.

code:

put Pic.Width(myImg)
put Pic.Height(myImg)


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.
Abbas_M




PostPosted: Sat Jan 16, 2010 6:21 pm   Post subject: Re: Help with collison detection

ok i understand thank you very much.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: