Im making a 2d game for school in c++ but i cant get the collosion working
i have to code it so the player cant walk trough walls and floors but i just dont got any idea how to make this work
does someone here have a idea for me to get this problem fixed?
if(player is on the left side of wall)
{
collision = false;
}
elseif(player is on the right side of wall)
{
collision = false;
}
elseif(player is under the wall)
{
collision = false;
}
elseif(player is above the wall)
{
collision = false;
}
else
{
collision = true // Player isn't outside the box, so he must be inside, or collide with it :)
}