This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
notes:cprog:spring2025:projects:mtb3 [2025/03/05 18:44] – [brick field] bdildine | notes:cprog:spring2025:projects:mtb3 [2025/03/05 18:48] (current) – [array of bricks] bdildine | ||
---|---|---|---|
Line 29: | Line 29: | ||
====array of bricks==== | ====array of bricks==== | ||
+ | You can use an array of boolean values to check if the box has had a collision or not. This would look something like: | ||
+ | < | ||
+ | bool[# | ||
+ | </ | ||
+ | You can make use of for loops to initialize every value in the array to true or false. | ||
+ | Then when drawing the boxes, use a for loop and only draw each box if the corresponding value in the boolean array is true or not | ||
+ | ( This would assume when the ball collides with the box you set that boxes boolean value to false ) | ||
====brick ball collision detection==== | ====brick ball collision detection==== |