Hi there,
I need some assistance with understanding the collision detection section of dapper-dasher.
We create the range based for loop to represent certain aspects of the nebula hazards in this case the X and y positions and width and height.
It is done as follows:
for(AnimData nebula : nebulae){
Rectangle nebRec{
nebula.pos.x + pad,
nebula pos.y + pad,
nebula.rec.width - 2pad,
nebula.rec.height - 2pad
}
}
The issue I am having is I don’t understand how this 2*pad works.
It’s supposed to draw a rectangle around the nebula for collision detection but how is this done because the value of pad is 20 so 2*pad =40.
Can explain this code please