Saturday, 17 August 2013

C++ Collision with Sprite against object ( blocks )

C++ Collision with Sprite against object ( blocks )

This is a RightSideCollision function that if the first sprite A collides
on the right side of B it shouldn't be able to pass through it. I've
checked my code a lot and I can't find the problem :( w stands for width h
for height x for x-axis y for y-axis A for one of the objects, B for the
other.
Void RightSideCollision(float Ax,float Ay,float Aw,float Ah,float Bx,float
By,float Bw,float Bh)
{ if( Ax < Bx + Bw && Ay < By + Bh && Ay + Ah > By )
{
Ax = Bx + Bw;
}
}

No comments:

Post a Comment