本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Animation.isAnimationFinished方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.isAnimationFinished方法的具體用法?Java Animation.isAnimationFinished怎麽用?Java Animation.isAnimationFinished使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.Animation
的用法示例。
在下文中一共展示了Animation.isAnimationFinished方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawCowboy
import com.badlogic.gdx.graphics.g2d.Animation; //導入方法依賴的package包/類
/**
* Draw Cowboy State and Animation
*/
private void drawCowboy(){
int i=0;
for(Cowboy cowboy : world.getCowboys()){
Animation animation;
if(i==1) { //right side cowboy
animation = getAnimation(cowboy.getState(), "left");
if(animation == null)
currentFrame = cowboyIdleRight;
}else{ //left side cowboy
animation = getAnimation(cowboy.getState(), "right");
if(animation == null)
currentFrame = cowboyIdleLeft;
}
if (animation != null) {
if (flagFinishShot && cowboy.getState().equals(Cowboy.State.WIN) && cowboy.getCowboyId() == winId) {
winStateTime += Gdx.graphics.getDeltaTime();
currentFrame = animation.getKeyFrame(winStateTime, true);
} else {
if (animation.isAnimationFinished(stateTime)) {
if (cowboy.isFlagHit() && cowboy.getCowboyId() == winId) {
cowboy.setState(Cowboy.State.WIN);
flagFinishShot = true;
stateTime = 0;
}else {
currentFrame = animation.getKeyFrame(stateTime);
}
} else {
stateTime += Gdx.graphics.getDeltaTime();
currentFrame = animation.getKeyFrame(stateTime, true);
}
}
}
spriteBatch.draw(currentFrame, cowboy.getPosition().x * ppuX, cowboy.getPosition().y * ppuY,
cowboy.SIZE * ppuX, cowboy.SIZE * ppuY);
i++;
}
}
示例2: drawCowboy
import com.badlogic.gdx.graphics.g2d.Animation; //導入方法依賴的package包/類
/**
* Draw Cowboy State and Animation
*/
private void drawCowboy(){
int i=0;
for(Cowboy cowboy : world.getCowboys()){
Animation animation;
if(i==1) { //right side cowboy
animation = getAnimation(cowboy.getState(), "left");
if(animation == null) {
if(cowboy.getState().equals(Cowboy.State.HIDE))
currentFrame = cowboyHideRight;
else
currentFrame = cowboyIdleRight;
}
}else{ //left side cowboy
animation = getAnimation(cowboy.getState(), "right");
if(animation == null)
if(cowboy.getState().equals(Cowboy.State.HIDE))
currentFrame = cowboyHideLeft;
else
currentFrame = cowboyIdleLeft;
}
if (animation != null) {
if (flagFinishShot && cowboy.getState().equals(Cowboy.State.WIN) && cowboy.getCowboyId() == winId) {
winStateTime += Gdx.graphics.getDeltaTime();
currentFrame = animation.getKeyFrame(winStateTime, true);
} else {
if (animation.isAnimationFinished(stateTime)) {
if (cowboy.isFlagHit() && cowboy.getCowboyId() == winId) {
cowboy.setState(Cowboy.State.WIN);
flagFinishShot = true;
stateTime = 0;
}else {
currentFrame = animation.getKeyFrame(stateTime);
}
} else {
stateTime += Gdx.graphics.getDeltaTime();
currentFrame = animation.getKeyFrame(stateTime, true);
}
}
}
spriteBatch.draw(currentFrame, cowboy.getPosition().x * ppuX, cowboy.getPosition().y * ppuY,
cowboy.getSize() * ppuX, cowboy.getSize() * ppuY);
i++;
}
}