I have received an error saying "Illegal use of this type as an expression", why is my compiler throwing this error?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
if (m_pPlayer->GetPlayerPos().x < BasicEnemy.GetEnemyPos().x)
{
Direction = LEFT;
}
else
{
Direction = RIGHT;
}
if (m_pPlayer->GetPlayerPos().y < BasicEnemy.GetEnemyPos().y)
{
Direction = UP;
}
else
{
Direction = DOWN;
}
Without what any of those identifier mean, it's impossible to know. If I had to venture a guess, though, I'd guess that BasicEnemy is a type and not an object. A type name followed by a dot is not valid syntax. Maybe you meant to use ::? Like I said, it's impossible to tell without context.