Ok another new problem im having is that when the enemy reaches the edge of the screen, it should change its direction by -1...
float enemyMove = 150;
float enemyX = Sprite2.GetPosition().x;
bool bEnemy = true;
if (enemyX >= wWidth)
bEnemy = false;
if (bEnemy)
{
Sprite2.Move(enemyMove * ElapsedTime, 0);
}
else if(!bEnemy)
{
Sprite2.Move(enemyMove * ElapsedTime * -1, 0);
}
I know this code is defunct, and that it creates an endless loop and gets stuck between the edge of the window and one pixel from the edge of the window causing it to bounce by 1 pixel over and over again. I have tried numerous things but cant get this to work, any ideas?