ok i using libgdx for android game development and i have a AI which moves depending on value of variable "ENEMYSPEED". Initally the value is set as
static float EnemySPEED = 0.5f;
and everything works fine. so i perform a simply compute like this
EnemyVector.y -= EnemySPEED
Everything fine so far...
Now i feel my AI is moving fast and i decrease the variable value from 0.5f to 0.4f and i perform the same operation of decrement and it doesn't decrement!
What is going on??!!!
EDIT:
private void EnemyMove()
{
EnemySection = findSection(Enemy);
if(EnemySection == PlayerSection)
{
if(EnemyVector.x > PlayerVector.x) EnemyVector.x -= EnemySPEED;
else if(EnemyVector.x < PlayerVector.x) EnemyVector.x += EnemySPEED;
else if(EnemyVector.y > PlayerVector.y) EnemyVector.y -= EnemySPEED;
else if(EnemyVector.y < PlayerVector.y) EnemyVector.y += EnemySPEED;
}
else if(EnemySection == 1 ||EnemySection == 3) EnemyVector.x += EnemySPEED;
else if(EnemySection == 2 ||EnemySection == 4) EnemyVector.x -= EnemySPEED;
else if(EnemySection == 5)
{
if(EnemyVector.y > 212 || EnemyVector.y < 75)
{
if(PlayerSection == 1 ||PlayerSection == 3) EnemyVector.x -= EnemySPEED;
else if(PlayerSection == 2 ||PlayerSection == 4) EnemyVector.x += EnemySPEED;
}
else
{
if(PlayerSection == 1 ||PlayerSection == 2) EnemyVector.y += EnemySPEED;
else if(PlayerSection == 3 ||PlayerSection == 4) EnemyVector.y -= EnemySPEED;
}
}
if(Player.overlaps(Enemy)) System.out.println("Target Acquired!");
System.out.println(EnemyVector.x + "," + EnemyVector.y);
}
findSection finds in which quadrant the Enemy or player is in depending on parameter passed.
EDIT 2: i just noticed that it only works for 0.5,1,1.5 not any value in between. Is this some kind of limitation?
-=increases the speed. But then why is everything fine? You also "feel", but is it actual?