Java Code Examples for com.badlogic.gdx.scenes.scene2d.actions.SequenceAction#addAction()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.actions.SequenceAction#addAction() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultZoneView.java    From Cardshifter with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomCard(final CardViewSmall cardView) {
	if (this.cardZoomedIn) {
		return;
	}
	final CardViewSmall cardViewCopy = new CardViewSmall(this.context, cardView.cardInfo, this, true);
	cardViewCopy.getActor().setPosition(Gdx.graphics.getWidth()/2.7f, Gdx.graphics.getHeight()/30);
	this.context.getStage().addActor(cardViewCopy.getActor());
	this.initialCardViewWidth = cardView.getActor().getWidth();
	this.initialCardViewHeight = cardView.getActor().getHeight();
	SequenceAction sequence = new SequenceAction();
	Runnable adjustForZoom = new Runnable() {
	    @Override
	    public void run() {
	    	cardViewCopy.zoom();
	    }
	};
	sequence.addAction(Actions.sizeTo(Gdx.graphics.getWidth()/4, Gdx.graphics.getHeight()*0.9f, 0.2f));
	sequence.addAction(Actions.run(adjustForZoom));		
	cardViewCopy.getActor().addAction(sequence);
	this.cardZoomedIn = true;
}
 
Example 2
Source File: DeckBuilderScreen.java    From Cardshifter with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomCard(final CardViewSmall cardView) {
	if (this.cardZoomedIn) {
		return;
	}
	final CardViewSmall cardViewCopy = new CardViewSmall(this.context, cardView.cardInfo, this, true);
	cardViewCopy.setTargetable(TargetStatus.TARGETABLE, this);
	cardViewCopy.getActor().setPosition(this.screenWidth/2.7f, this.screenHeight/30);
	this.game.stage.addActor(cardViewCopy.getActor());
	this.initialCardViewWidth = cardView.getActor().getWidth();
	this.initialCardViewHeight = cardView.getActor().getHeight();
	SequenceAction sequence = new SequenceAction();
	Runnable adjustForZoom = new Runnable() {
	    @Override
	    public void run() {
	    	cardViewCopy.zoom();
	    }
	};
	sequence.addAction(Actions.sizeTo(this.screenWidth/4, this.screenHeight*0.9f, 0.2f));
	sequence.addAction(Actions.run(adjustForZoom));		
	cardViewCopy.getActor().addAction(sequence);
	this.cardZoomedIn = true;
}
 
Example 3
Source File: Entity.java    From Norii with Apache License 2.0 5 votes vote down vote up
public void moveAttack(List<GridCell> path, Entity target) {
	final SequenceAction sequence = createMoveSequence(path);
	sequence.addAction(new AttackAction(target));
	sequence.addAction(run(aiFinishTurn));

	this.getEntityactor().addAction(sequence);
	this.setAp(this.getAp() - path.size() - this.getEntityData().getBasicAttackCost());
}
 
Example 4
Source File: Entity.java    From Norii with Apache License 2.0 5 votes vote down vote up
private SequenceAction createMoveSequence(List<GridCell> path) {
	GridCell oldCell = new GridCell(this.getCurrentPosition().getTileX(), this.getCurrentPosition().getTileY());
	final SequenceAction sequence = Actions.sequence();
	for (final GridCell cell : path) {
		sequence.addAction(Actions.rotateTo(decideRotation(oldCell, cell), 0.1f));
		sequence.addAction(moveTo(cell.x, cell.y, 0.2f));
		sequence.addAction(run(updatePositionAction));
		oldCell = cell;
	}
	return sequence;
}
 
Example 5
Source File: Tutorial.java    From martianrun with Apache License 2.0 5 votes vote down vote up
public Tutorial(Rectangle bounds, String assetsId, String text) {
    this.bounds = bounds;
    this.text = text;
    textureRegion = AssetsManager.getTextureRegion(assetsId);
    SequenceAction sequenceAction = new SequenceAction();
    sequenceAction.addAction(Actions.delay(4f));
    sequenceAction.addAction(Actions.removeActor());
    addAction(sequenceAction);
    font = AssetsManager.getSmallestFont();
    setWidth(bounds.width);
    setHeight(bounds.height);
}
 
Example 6
Source File: Entity.java    From Norii with Apache License 2.0 4 votes vote down vote up
public void move(List<GridCell> path) {
	final SequenceAction sequence = createMoveSequence(path);
	sequence.addAction(run(aiFinishTurn));
	this.getEntityactor().addAction(sequence);
	this.setAp(this.getAp() - path.size());
}