WorksheetsObject Collision
Total questions: 19
Worksheet time: 10mins
Which statement best defines an object collision in a 2D game?
Two graphic objects overlap on the screen
Two images load on the same Surface
Two Rects have identical width and height
Two sprites move at the same speed together
In PyGame, which structure is commonly used to check whether two objects intersect?
Color tuples that represent pixel values
Surface layers that store background art
Rect objects that track position and size
Coordinate pairs stored in lists
What does a Surface represent when building a simple PyGame scene?
A collision map for physics
A rectangle that stores size only
A coordinate pair for movement
An area where objects are drawn
Which option correctly pairs a term with its primary purpose in PyGame?
Coordinates (x, y) — locate an object on screen
Collision — define frame rate and timing
Rect — render textures and audio data
Surface — detect overlaps between sprites
A player sprite at coordinates (120, 80) and an obstacle have overlapping Rects on the same Surface. What conclusion is most accurate?
A collision has occurred between the two objects
No intersection exists between their boundaries
Only the obstacle has moved off the screen
The sprites share the same image resource
Which parameter in pygame.Rect(x, y, width, height) controls the horizontal screen position of the rectangle’s top-left corner?
y parameter controls horizontal position
width parameter controls horizontal position
x parameter controls horizontal position
height parameter controls horizontal position
In pygame.Rect(x, y, width, height), what do width and height represent?
The collision state between objects
The object’s size in pixels
The object’s starting coordinates
The window’s dimensions in pixels
What does rect1.colliderect(rect2) return when the two rectangles overlap on the screen?
True boolean value
False boolean value
An integer overlap area
A tuple of contact edges
Which code snippet correctly checks for a collision between two Rects named a and b?
if a.colliderect(b): handle()
if colliderect(a, b): handle()
if a.intersects(b): handle()
if a.collide(b) == True: handle()
Two Rect objects are placed so they touch edges without any area overlap. What will colliderect() most likely return?
True only for horizontal edges
True only for vertical edges
True because edges are touching
False because no area overlaps
Which statement best defines a collision event for Rects in PyGame?
Collision occurs when widths are equal
Collision occurs when centers match
Collision occurs when corners align
Collision occurs when areas overlap
If rectA has a smaller y value than rectB, which is typically true about their vertical relationship on a standard screen coordinate system?
rectA appears above rectB
rectA appears below rectB
rectA appears left of rectB
rectA overlaps rectB
Which change will move a Rect 10 pixels to the right without resizing it?
Increase width by 10 units
Decrease x by 10 units
Increase height by 10 units
Increase x by 10 units
A game must trigger a sound only when the player sprite overlaps an enemy. Which approach is most appropriate?
Compare widths of both rectangles
Use colliderect() in the update loop
Check if x and y values are equal
Only test when keys are pressed
Which condition best enforces movement constraints for a player rectangle in a 2D canvas with width W and height H? Assume x,y are the top-left coordinates and w,h are the rectangle size.
Scale position by canvas size every frame update
Reset position to center if x or y becomes negative
Reverse velocity whenever a key is pressed by user
Clamp x and y between 0 and W,H minus w,h
You implement arrow-key movement for a rectangle. What is the most reliable approach to ensure smooth movement?
Track key-down states and update each frame
Move only on keypress events without state
Increase speed when keys are held randomly
Use blocking delays after every key event
Two axis-aligned rectangles A and B should trigger a color change when they collide. Which collision test is correct?
A.area equals B.area at collision moment only
A.left equals B.right or A.right equals B.left exactly
A.right > B.left and A.left < B.right and A.bottom > B.top and A.top < B.bottom
A.center equals B.center in both axes exactly
When moving the target after a collision, which method best prevents spawning partially outside the screen?
Place at fixed corners alternating each score
Random x in [0, W - targetW], y in [0, H - targetH]
Random x and y anywhere in [0, W] and [0, H]
Random x,y then clamp only if off left edge
A rectangle controlled by arrow keys should not pass through walls. Which additional step beyond overlap testing most effectively prevents tunneling at high speeds?
Use per-axis movement with collision resolution after each axis
Increase speed further to cross walls quickly
Detect collisions using object areas only
Only check collision every few frames
