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


Java Animation.setSpeed方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

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