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


Java PointF类代码示例

本文整理汇总了Java中com.watabou.utils.PointF的典型用法代码示例。如果您正苦于以下问题:Java PointF类的具体用法?Java PointF怎么用?Java PointF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: update

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public void update() {
	if ((spent += Game.elapsed) > duration) {

		killAndErase();
		if (callback != null) {
			callback.call();
		}

	} else {
		float dx = to.x - from.x;
		float dy = to.y - from.y;
		for (int i = 0; i < chains.length; i++) {
			chains[i].center(new PointF(
					from.x + ((dx * (i / (float)chains.length)) * (spent/duration)),
					from.y + ((dy * (i / (float)chains.length)) * (spent/duration))
			));
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:21,代码来源:Chains.java

示例2: update

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public void update() {
	super.update();

	if (phase < 1) {
		if ((phase -= Game.elapsed) <= 0) {
			killAndErase();
		} else {
			scale.set((2 - phase) * radius / RADIUS);
			am = phase * (-1);
			aa = phase * (+1);
		}
	}

	if (visible = WandmakerSprite.this.visible) {
		PointF p = WandmakerSprite.this.center();
		point(p.x, p.y);
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:20,代码来源:WandmakerSprite.java

示例3: onTouchDown

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
protected void onTouchDown(Touch t) {

	if (t != touch && another == null) {

		if (!touch.down) {
			touch = t;
			onTouchDown(t);
			return;
		}

		pinching = true;

		another = t;
		startSpan = PointF.distance(touch.current, another.current);
		startZoom = camera.zoom;

		dragging = false;
	} else if (t != touch) {
		reset();
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:23,代码来源:CellSelector.java

示例4: update

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public void update() {

	if (visible = Dungeon.visible[pos]) {

		super.update();

		if ((delay -= Game.elapsed) <= 0) {

			delay = Random.Float();

			PointF p = DungeonTilemap.tileToWorld(pos);
			((Sparkle) recycle(Sparkle.class)).reset(
					p.x + Random.Float(DungeonTilemap.SIZE), p.y
							+ Random.Float(DungeonTilemap.SIZE));
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:19,代码来源:MineLevel.java

示例5: update

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public void update() {
	
	if (visible = Dungeon.visible[pos]) {
		
		super.update();
		
		if ((delay -= Game.elapsed) <= 0) {
			
			delay = Random.Float();
			
			PointF p = DungeonTilemap.tileToWorld( pos );
			((Sparkle)recycle( Sparkle.class )).reset( 
				p.x + Random.Float( DungeonTilemap.SIZE ), 
				p.y + Random.Float( DungeonTilemap.SIZE ) );
		}
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:19,代码来源:CavesLevel.java

示例6: Beam

import com.watabou.utils.PointF; //导入依赖的package包/类
private Beam(PointF s, PointF e, Effects.Type asset, float duration) {
	super(Effects.get(asset));

	origin.set(0, height / 2);

	x = s.x - origin.x;
	y = s.y - origin.y;

	float dx = e.x - s.x;
	float dy = e.y - s.y;
	angle = (float) (Math.atan2(dy, dx) * A);
	scale.x = (float) Math.sqrt(dx * dx + dy * dy) / width;

	Sample.INSTANCE.play(Assets.SND_RAY);

	timeLeft = this.duration = duration;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:18,代码来源:Beam.java

示例7: reset

import com.watabou.utils.PointF; //导入依赖的package包/类
public void reset(int from, int to, Callback callback) {
	this.callback = callback;

	revive();

	PointF pf = DungeonTilemap.tileCenterToWorld(from);
	PointF pt = DungeonTilemap.tileCenterToWorld(to);

	x = pf.x;
	y = pf.y;
	width = 0;
	height = 0;

	PointF d = PointF.diff(pt, pf);
	PointF speed = new PointF(d).normalize().scale(SPEED);
	sx = speed.x;
	sy = speed.y;
	time = d.length() / SPEED;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:20,代码来源:MagicMissile.java

示例8: reset

import com.watabou.utils.PointF; //导入依赖的package包/类
public void reset( int from, int to, float velocity, Callback callback ) {
	this.callback = callback;
	
	revive();
	
	PointF pf = DungeonTilemap.tileCenterToWorld( from );
	PointF pt = DungeonTilemap.tileCenterToWorld( to );
	
	x = pf.x;
	y = pf.y;
	width = 0;
	height = 0;
	
	PointF d = PointF.diff( pt, pf ); 
	PointF speed = new PointF( d ).normalize().scale( velocity );
	sx = speed.x;
	sy = speed.y;
	time = d.length() / velocity;
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:20,代码来源:MagicMissile.java

示例9: update

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public void update() {
	super.update();
	
	if (!visible) {
		visible = Dungeon.level.visited[cell] || Dungeon.level.mapped[cell];
	}
	
	if (visible) {
		PointF scroll = Camera.main.scroll;
		if (!scroll.equals( lastScroll )) {
			lastScroll.set( scroll );
			PointF center = Camera.main.center().offset( scroll );
			angle = (float)Math.atan2( cellCenter.x - center.x, center.y - cellCenter.y ) * RAD_2_G;
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:18,代码来源:Compass.java

示例10: reset

import com.watabou.utils.PointF; //导入依赖的package包/类
public void reset( int from, int to, float velocity, Callback callback ) {
	this.callback = callback;
	
	revive();
	
	PointF pf = DungeonTilemap.tileCenterToWorld( from );
	PointF pt = DungeonTilemap.tileCenterToWorld( to );
	
	x = pf.x;
	y = pf.y;
	width = 0;
	height = 0;
	
	PointF d = PointF.diff( pt, pf );
	PointF speed = new PointF( d ).normalize().scale( velocity );
	sx = speed.x;
	sy = speed.y;
	time = d.length() / velocity;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:20,代码来源:MagicMissile.java

示例11: update

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public void update() {
	
	if (visible = Dungeon.visible[pos]) {
		
		super.update();

		if ((delay -= Game.elapsed) <= 0) {

			//pickaxe can remove the ore, should remove the sparkling too.
			if (Dungeon.level.map[pos] != Terrain.WALL_DECO){
				kill();
				return;
			}
			
			delay = Random.Float();
			
			PointF p = DungeonTilemap.tileToWorld( pos );
			((Sparkle)recycle( Sparkle.class )).reset(
				p.x + Random.Float( DungeonTilemap.SIZE ),
				p.y + Random.Float( DungeonTilemap.SIZE ) );
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:25,代码来源:CavesLevel.java

示例12: proc

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
	// lvl 0 - 33%
	// lvl 1 - 50%
	// lvl 2 - 60%
	int level = Math.max( 0, weapon.level() );

	if (Random.Int( level + 3 ) >= 2) {

		Buff.affect(defender, Bleeding.class).set(damage/4);
		Splash.at( defender.sprite.center(), -PointF.PI / 2, PointF.PI / 6,
				defender.sprite.blood(), 10 );

	}

	return damage;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:18,代码来源:Vorpal.java

示例13: Camera

import com.watabou.utils.PointF; //导入依赖的package包/类
public Camera( int x, int y, int width, int height, float zoom ) {
	
	this.x = x;
	this.y = y;
	this.width = width;
	this.height = height;
	this.zoom = zoom;
	
	screenWidth = (int)(width * zoom);
	screenHeight = (int)(height * zoom);
	
	scroll = new PointF();
	
	matrix = new float[16];
	Matrix.setIdentity( matrix );
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:17,代码来源:Camera.java

示例14: Visual

import com.watabou.utils.PointF; //导入依赖的package包/类
public Visual(float x, float y, float width, float height)
{
    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;

    scale = new PointF(1, 1);
    origin = new PointF();

    matrix = new float[16];

    resetColor();

    speed = new PointF();
    acc = new PointF();
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:18,代码来源:Visual.java

示例15: update

import com.watabou.utils.PointF; //导入依赖的package包/类
@Override
public void update() {
	super.update();
	
	if (phase < 1) {
		if ((phase -= Game.elapsed) <= 0) {
			killAndErase();
		} else {
			scale.set( (2 - phase) * radius / RADIUS );
			am = phase * (-1);
			aa = phase * (+1);
		}
	}
	
	if (visible = WandmakerSprite.this.visible) {
		PointF p = WandmakerSprite.this.center();
		point(p.x, p.y );
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:20,代码来源:WandmakerSprite.java


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