perfectRotation -= (alpha / Math.abs(alpha)) * 360;
}
Vector2D vel = Singleton.getWorldModel().getEntityVelocity(m_playerName);
if (currentRotation != perfectRotation) {
if (currentRotation < perfectRotation) {
Singleton.getWorldModel().control(Control.Q, m_playerName);
} else {
Singleton.getWorldModel().control(Control.D, m_playerName);
}
}
float bias = Math.abs(alpha);
bias = Math.abs((bias > 180) ? (bias - 360) : (bias));
if (bias > ROTATION_CRITIC && vel.length() > 5) {
Singleton.getWorldModel().control(Control.SHIFT_LEFT, m_playerName);
} else {
Singleton.getWorldModel().control(Control.Z, m_playerName);
}
//Singleton.getWorldModel().control(Control.Z, m_playerName);
// System.out.println("C:"+currentRotation+" / P:"+perfectRotation);
if (m_fireTime != -1 && m_fireTime < Singleton.getWorldModel().getTime()) {
Singleton.getWorldModel().control(Control.SPACE, m_playerName);
}
if (m_fireTime == -1 && Singleton.getWorldModel().getEntityHasItem(m_playerName)) {
m_fireTime = (float) (Singleton.getWorldModel().getTime() + (Math.random() * 10000.f) + 3000.f);
}
//CHECK RESET
// System.out.println(vel.length());
if (vel.length() > 5 || Singleton.getWorldModel().getTime() < m_lastResetTime + 3000) {
m_lastMovingTime = Singleton.getWorldModel().getTime();
}
//RESET
if (Singleton.getWorldModel().getTime() > m_lastMovingTime + 1000) {
Vector2D pos = m_lastValidPosition.scale(1 / 64.f);
m_lastValidPosition.x = Math.round(m_lastValidPosition.x);
m_lastValidPosition.y = Math.round(m_lastValidPosition.y);
m_lastValidPosition = m_lastValidPosition.scale(64);
m_lastValidPosition = m_lastValidPosition.translate(32, 32);
int code = Singleton.getVisualisation().getTile(Visualisation.MAP_LAYER.IA, pos);