[SFML] Tile collision set value to true

Started by
0 comments, last by Khatharr 7 years, 11 months ago

So I currently have a basic tile collision however, once collided, it doesn't set back to true unless im inside the collision, any ideas on how to improve this?


for (int i = 0; i < obj.size(); i++)
	{
		if (BoundingBox().intersects(obj[i].rect))
		{
			if (obj[i].name == "solid")
			{
				if (playerSprite.getPosition().x < obj[i].rect.left)
				{
					canMoveRight = false;
				}
				else
				{
					canMoveRight = true;
				}
			}

		}
	}
Advertisement

I think (?) this is what you're after.


canMove = true
for obj in objects {
  if collide with obj {
    canMove = false
    break
  }
}

Otherwise please provide a lot more context.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement