I got a collision method from someone else's source, but I don't know where he learned it from (what tutorial). He says libsdl.org but I haven't been able to find it.
This is the collision method, and I don't think he made it up, so I think he got it from somewhere.
if you can point me to the online location of this I will be happy, in the meantime I will continue searching for it because I really want it.Code:void collision() { RECT rcOne, rcTwo,rcThree, rcTemp,rcTemp2; SetRect(&rcOne,paddle1.xpos,paddle1.ypos,paddle1.xpos+paddle1.width,paddle1.ypos+paddle1.height); SetRect(&rcTwo,paddle2.xpos,paddle2.ypos,paddle2.xpos+paddle2.width,paddle2.ypos+paddle2.height); SetRect(&rcThree,ball.xpos,ball.ypos,ball.xpos+ball.width,ball.ypos+ball.height); if(IntersectRect(&rcTemp,&rcOne,&rcThree)) { ball.direction = 5; } if(IntersectRect(&rcTemp2,&rcTwo,&rcThree)) { ball.direction = -5; } if(ball.xpos == 0) { ball.direction = 5; } if(ball.xpos == 620) { ball.direction = -5; } }
and yes I would ask him but he's gone.



LinkBack URL
About LinkBacks


