}
public void addEventListeners() {
KeyListener fire2KeyEvent = new KeyListener()
{
public void onKeyDown(){};
public void keyPressed()
{
if (orb != null)
orb.setMove(Orb.ADJUDTING);
};
public void onKeyUp()
{
if (orb != null)
orb.setMove(Orb.STICKED);
};
};
EventManager.instance().addListener(fire2Key, fire2KeyEvent);
KeyListener upKeyEvent = new KeyListener()
{
public void keyPressed()
{
speed.y += ACCELLERATION * tick;
if (speed.y > MAX_SPEED)
speed.y = MAX_SPEED;
};
public void onKeyUp()
{
y_deceleration = -DEFAULT_DECELERATION;
};
};
EventManager.instance().addListener(upKey, upKeyEvent);
KeyListener downKeyEvent = new KeyListener()
{
public void onKeyDown()
{
};
public void keyPressed()
{
speed.y -= ACCELLERATION * tick;
if (speed.y < -MAX_SPEED)
speed.y = -MAX_SPEED;
};
public void onKeyUp()
{
y_deceleration = DEFAULT_DECELERATION;
};
};
EventManager.instance().addListener(downKey, downKeyEvent);
KeyListener leftKeyEvent = new KeyListener()
{
public void onKeyDown()
{
};
public void keyPressed()
{
speed.x -= ACCELLERATION * tick;
if (speed.x < -MAX_SPEED)
speed.x = -MAX_SPEED;
};
public void onKeyUp()
{
x_deceleration = DEFAULT_DECELERATION;
};
};
EventManager.instance().addListener(leftKey, leftKeyEvent);
KeyListener rightKeyEvent = new KeyListener()
{
public void onKeyDown()
{
};
public void keyPressed()
{
speed.x += ACCELLERATION * tick;
if (speed.x > MAX_SPEED)
speed.x = MAX_SPEED;
accelerateEntrity.startAnimation();
};
public void onKeyUp()
{
accelerateEntrity.stopAnimation();
x_deceleration = -DEFAULT_DECELERATION;
};
};
EventManager.instance().addListener(rightKey, rightKeyEvent);
KeyListener fire1KeyEvent = new KeyListener()
{
public void onKeyDown()
{
concentrateAnimation.fire(0.1f);
concentrateAnimation.startChargingAnimation();