当前位置: 首页>>代码示例>>Java>>正文


Java Animation.setLooping方法代码示例

本文整理汇总了Java中org.newdawn.slick.Animation.setLooping方法的典型用法代码示例。如果您正苦于以下问题:Java Animation.setLooping方法的具体用法?Java Animation.setLooping怎么用?Java Animation.setLooping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.newdawn.slick.Animation的用法示例。


在下文中一共展示了Animation.setLooping方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public void init(GameContainer container) throws SlickException //fait par VS, JD et FS
{
	
	//Initialisation of animation when BOOOOM !
	explosionAnimation  = new Animation();
	explosionImage1 = new Image ("boom1.png");
	explosionImage2 = new Image ("boom2.png");
	explosionImage3 = new Image ("boom3.png");
	explosionImage4 = new Image ("boom4.png");
	explosionAnimation.addFrame(explosionImage1, 25);
	explosionAnimation.addFrame(explosionImage2, 35);
	explosionAnimation.addFrame(explosionImage3, 35);
	explosionAnimation.addFrame(explosionImage4, 150);
	explosionAnimation.setLooping(false);
	
	//Graphic aspect
	ttf = new TrueTypeFont(font, true);
	container.getGraphics().setBackground(new Color(193, 184, 176)); 
	
	//Input management on TextArea
	pseudoEntry = new TextArea(20,20,150,20);
	container.getInput().addKeyListener(pseudoEntry);
	container.getInput().addMouseListener(pseudoEntry);
	pseudoEntry.setPosition(grid.getRightPosition(), getNextCommandPosition(0));
}
 
开发者ID:UTBroM,项目名称:2COA,代码行数:26,代码来源:WindowGame.java

示例2: TimeMeter

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public TimeMeter(float xPos, float yPos, float xOffset, float yOffset, float entityWidth, float entityHeight, int timeLimit) throws SlickException {
	
	// Basic attributes
	this.xPos = xPos;
	this.yPos = yPos;
	originalXPos = xPos;
	originalYPos = yPos;
	this.xOffset = xOffset;
	this.yOffset = yOffset;
	width = height = 30;
	
	// Visibility
	visible = false;
	
	// Create the Circle SpriteSheet
	circle = ResourceLoader.getInstance().timeSpriteSheet;
	circle.setFilter(Image.FILTER_NEAREST);
	timeAnimation = new Animation(circle, 0, 0, 26, 0, true, 1, true);
	timeAnimation.setLooping(false);
	
	// Calculate the animation speed based on the Time Limit
	this.timeLimit = timeLimit;
	animationSpeed = 1000f / timeLimit / ((float)timeAnimation.getFrameCount() - 1f);
	timeAnimation.setSpeed(animationSpeed);
}
 
开发者ID:lucas-tulio,项目名称:awesome-game-store,代码行数:26,代码来源:TimeMeter.java

示例3: AnimationRenderComponent

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
/**
 * Create a new AnimationRenderComponent based on the information provided
 *
 * @param frames
 *          the individual animation frames to be displayed in order
 * @param speed
 *          the speed at which the images change
 * @param width
 *          the width of the images
 * @param height
 *          the height of the images
 * @param looping
 *          whether the first frame shall be displayed when the animation is
 *          over or not.
 */
public AnimationRenderComponent(Image[] frames, float speed, float width, float height, boolean looping) {
    super("AnimationRenderComponent");

    // set the size for this component
    size = new Vector2f(width, height);

    // create a new Animation object based on the frames with a duration of 1
    animation = new Animation(frames, 1);

    // assign the other parameters (speed, looping mode)
    animation.setSpeed(speed);
    animation.setLooping(looping);

    // start the animation
    animation.start();
}
 
开发者ID:joshimoo,项目名称:Gorillaz,代码行数:32,代码来源:AnimationRenderComponent.java

示例4: loadAnimation

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
protected Animation loadAnimation(SpriteSheet spriteSheet, int startX, int endX, int startY, int endY, boolean looped, int speed) {
    Animation animation = new Animation();
    for (int y = startY; y < endY; y++) {
        for (int x = startX; x < endX; x++) {
            animation.addFrame(spriteSheet.getSprite(x, y), speed);
        }

    }
    animation.setLooping(looped);
    return animation;
}
 
开发者ID:LeNiglo,项目名称:TinyTank,代码行数:12,代码来源:AnimatorFactory.java

示例5: addAnimation

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public void addAnimation(EnumAnimation type, Animation animation) {
    if (animation.getFrameCount() == 1) {
        animation.setAutoUpdate(false);
        animation.setLooping(false);
    }

    if (this.animations.containsKey(type)) {
        this.animations.get(type).add(animation.copy());
    } else {
        List<Animation> values = new ArrayList<>();
        values.add(animation.copy());
        this.animations.put(type, values);
    }
}
 
开发者ID:LeNiglo,项目名称:TinyTank,代码行数:15,代码来源:Animator.java

示例6: setup

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public void setup() throws CretionException {
    positionComponent = entity.getComponent(PositionComponent.class);
    spriteSheet = ResourceLoader.loadSpriteSheet(path,
            new Dimension(entity.getComponent(DimensionComponent.class).getWidth(),
                    entity.getComponent(DimensionComponent.class).getHeight()));
    animation = new Animation(spriteSheet, start.x, start.y, end.x, end.y, true, duration, false);
    animation.setLooping(looping);
}
 
开发者ID:Pheelbert,项目名称:cretion,代码行数:9,代码来源:AnimationComponent.java

示例7: Spark

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public Spark(float x, float y) {
    super(x-50*scaleFactor, y-50*scaleFactor, ObjectType.Spark);
    
    // default boundingBox méretéhez igazítása
    // boundingBox.setSize(scaleFactor*160.0f, scaleFactor*120.0f);
    
    
    // animáció inicializálása
    Image[] frames = new Image[4];
    int[] duration = new int[4];
    
    Random random = new Random();
    float rot = random.nextFloat()*360.0f;

    try {
        for (int i = 0; i < 4; i++) {
            frames[i] = new Image("res\\spark\\spark-" + i + ".png").getScaledCopy(scaleFactor);
            frames[i].rotate(rot); 
            duration[i] = 16;  
        }
    } catch (SlickException e) {
        e.printStackTrace();
    }

    animation = new Animation(frames, duration);
    animation.setLooping(false);
}
 
开发者ID:tiborsimon,项目名称:java-shooter-game,代码行数:28,代码来源:Spark.java

示例8: Explosion

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public Explosion(float x, float y) {
	super(x-scaleFactor*80.0f, y-scaleFactor*60.0f, ObjectType.Explosion);
	
	// default boundingBox méretéhez igazítása
	// boundingBox.setSize(scaleFactor*160.0f, scaleFactor*120.0f);
	
	
	// animáció inicializálása
	Image[] frames = new Image[90];
	int[] duration = new int[90];
	
	Random random = new Random();
	float rot = random.nextFloat()*360.0f;

	try {
		for (int i = 0; i < 90; i++) {
			frames[i] = new Image("res\\expl\\explosion_" + i + ".png").getScaledCopy(scaleFactor);
			frames[i].rotate(rot);
			duration[i] = 16;  
		}
	} catch (SlickException e) {
		e.printStackTrace();
	}

	animation = new Animation(frames, duration);
	animation.setLooping(false);
}
 
开发者ID:tiborsimon,项目名称:java-shooter-game,代码行数:28,代码来源:Explosion.java

示例9: Ghost

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public Ghost(int x, int y, int dir, String script, Game game) throws SlickException {
	
	super(x, y, 5, dir, script, false, game, "ghost", true, 0);
	
	SpriteSheet sheet = new SpriteSheet(Main.loadImage("res/ghost.png"), 30, 40);
	
	for (int i = 0; i < 4; i++) {
		
		Animation anim = new Animation(sheet, 0, i, 3, i, true, 1, true);
			anim.setSpeed(0.005f);
			anim.setLooping(true);
			anim.start();
		
		animations.add(anim);
		
	}
	
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:19,代码来源:Ghost.java

示例10: Bomb

import org.newdawn.slick.Animation; //导入方法依赖的package包/类
public Bomb(int x, int y, String script, boolean scriptable, Game game, int listenerLevel) throws SlickException {
	
	super(x, y, 5, 0, script, scriptable, game, "bomb", true, listenerLevel);
	bomb = Main.loadImage("res/bomb.png");
	
	SpriteSheet sheet = new SpriteSheet(Main.loadImage("res/explode.png"), 64, 64);
	
	explode = new Animation(sheet, 0, 0, 2, 0, true, 1, true);
	explode.setLooping(false);
	explode.setSpeed(0.05f);
	
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:13,代码来源:Bomb.java


注:本文中的org.newdawn.slick.Animation.setLooping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。