Computer Science Canada

Array based collision detection

Author:  Chrispy [ 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

Author:  Insectoid [ 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.


: