1/20
Looks like no tags are added yet.
What is collision detection?
The process of checking whether two objects touch or overlap.
What is distance?
The amount of space between two points or objects.
What do x and y represent in Canvas?
The horizontal and vertical coordinates of a position.
What do x1 and y1 represent?
The first object's centre coordinates.
What do x2 and y2 represent?
The second object's centre coordinates.
What is the formula for distance between two points?
d = √((x2 − x1)² + (y2 − y1)²).
What is the order for calculating distance using the formula?
Subtract the coordinates, square the differences, add them, and calculate the square root.
What is a radius?
The distance from the centre of a circle to its edge.
What is the circle collision condition?
d ≤ r1 + r2.
What does d represent in the circle collision condition?
The distance between the centres of the two circles.
What do r1 and r2 represent?
The radii of the first and second circles.
When do two circles collide or touch?
When the distance between their centres is less than or equal to the sum of their radii.
When do two circles not collide?
When the distance between their centres is greater than the sum of their radii.
Two circles have radii of 3 and 4 pixels, and their centres are 5 pixels apart. Is there a collision?
Yes. 5 ≤ 3 + 4, so the circles overlap.
Two circles have radii of 2 and 3 pixels, and their centres are 8 pixels apart. Is there a collision?
No. 8 > 2 + 3, so the circles do not touch.
What does Math.sqrt() do in JavaScript?
It calculates the square root of a number.
What do dx and dy commonly represent in collision-detection code?
The horizontal and vertical differences between two objects' centre coordinates.
What does the <= operator mean?
Less than or equal to.
What does an if statement do?
It runs a block of code when its condition is true.
Why are the radii added together when checking circle collisions?
The sum gives the maximum centre distance at which two circles can touch.
Which collision-detection method is described by comparing centre distance with the sum of radii?
Circle-based collision detection.