Example usage for com.badlogic.gdx.scenes.scene2d.actions RotateByAction setAmount

List of usage examples for com.badlogic.gdx.scenes.scene2d.actions RotateByAction setAmount

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.actions RotateByAction setAmount.

Prototype

public void setAmount(float rotationAmount) 

Source Link

Usage

From source file:com.netthreads.gdx.app.sprite.ShipSprite.java

License:Apache License

/**
 * Handle ship collision with something.
 * /*from ww w.  j a v  a 2s  . co  m*/
 */
public void runCollision() {
    // ---------------------------------------------------------------
    // Signal this sprite is busy.
    // ---------------------------------------------------------------
    AppStates.shipSpriteBusy = true;

    // ---------------------------------------------------------------
    // Clear existing actions.
    // ---------------------------------------------------------------
    clearActions();

    // ---------------------------------------------------------------
    // Rotate
    // ---------------------------------------------------------------
    float durationRotate = ROTATION_DURATION;
    this.setRotation(0);
    RotateByAction rotateBy = pool.obtain();
    rotateBy.setAmount(durationRotate);
    CallBackAction callBackAction = CallBackAction.$(this);

    // Add action.
    addAction(Actions.sequence(rotateBy, callBackAction));
}