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

Username:   Password: 
 RegisterRegister   
 Array based collision detection
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Chrispy




PostPosted: Tue Jul 17, 2018 7:32 pm   Post subject: Array based collision detection

What is it you are trying to achieve?
Check if a player has touched one of 10 red squares


What is the problem you are having?
I cannot figure out how to do array based collision detection with red squares that are 14x14 px wide and long


Describe what you have tried to solve this problem
Check for each x and y coordinate


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

In the attachment

Please specify what version of Turing you are using
4.1.2 / Open Turing



DodgeGame.t
 Description:

Download
 Filename:  DodgeGame.t
 Filesize:  7.78 KB
 Downloaded:  159 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Wed Jul 18, 2018 11:19 am   Post subject: RE:Array based collision detection

You can easily write a function that takes a 2 sets of coordinates and returns whether there is a collision between them. Then you simply loop over your array of coordinates, passing each to the function in turn.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: