嘿,我试图检查我的玩家类中的边界框是否与我的地图图块的边界框发生冲突。但是它出现了这个错误。我的 map.h 中有一个名为 Player playermap 的定义;包含我的播放器 h。然后我通过说如果 mapplayer.boundingbox.intersects(platformboundingbox) 然后发生碰撞来检查它们是否相交。看看,任何见解将不胜感激
这是我的地图类的一部分
if(mapVector[i][j] == 1)
{
sprite.SetImage(BlockImage);
sprite.SetPosition(j * BLOCKSIZE, i * BLOCKSIZE);
platformBoundingBox.Top = sprite.GetPosition().y - 5;
platformBoundingBox.Bottom = sprite.GetPosition().y;
platformBoundingBox.Left = sprite.GetPosition().x - 5;
platformBoundingBox.Right = sprite.GetPosition().x;
Window.Draw(sprite);
if(mapPlayer.boundingBox.Intersects(platformBoundingBox))
cout<<"collision occured";
}
这是我的 map.h 文件中出现错误的地方
Player mapPlayer;