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


Java PointF.length方法代码示例

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


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

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

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

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

示例4: reset

import com.watabou.utils.PointF; //导入方法依赖的package包/类
public void reset(int from, int to, int image, Glowing glowing,
                  Callback listener) {
	revive();

	view(image, glowing);

	this.callback = listener;

	point(DungeonTilemap.tileToWorld(from));
	PointF dest = DungeonTilemap.tileToWorld(to);

	PointF d = PointF.diff(dest, point());
	speed.set(d).normalize().scale(SPEED);

	if (image == ItemSpriteSheet.DART
			|| image == ItemSpriteSheet.INCENDIARY_DART
			|| image == ItemSpriteSheet.CURARE_DART
			|| image == ItemSpriteSheet.JAVELIN) {

		angularSpeed = 0;
		angle = 135 - (float) (Math.atan2(d.x, d.y) / 3.1415926 * 180);

	} else if (image == ItemSpriteSheet.WAVE
			|| image == ItemSpriteSheet.SKULLWEP) {

		angularSpeed = 0;
		angle = 90 - (float) (Math.atan2(d.x, d.y) / 3.1415926 * 180);

	} else {

		angularSpeed = image == 15 || image == 106 ? 1440 : 720;

	}

	PosTweener tweener = new PosTweener(this, dest, d.length() / SPEED);
	tweener.listener = this;
	parent.add(tweener);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:39,代码来源:MissileSprite.java

示例5: reset

import com.watabou.utils.PointF; //导入方法依赖的package包/类
public void reset( int from, int to, int image, Glowing glowing, Callback listener ) {
	revive();
	
	view( image, glowing );
	
	this.callback = listener;

	point( DungeonTilemap.tileToWorld( from ) );
	PointF dest = DungeonTilemap.tileToWorld( to );
	
	PointF d = PointF.diff( dest, point() );
	speed.set( d ).normalize().scale( SPEED );

	if (image == ItemSpriteSheet.DART || image == ItemSpriteSheet.INCENDIARY_DART
			|| image == ItemSpriteSheet.CURARE_DART  || image == ItemSpriteSheet.JAVELIN) {

		angularSpeed = 0;
		angle = 135 - (float)(Math.atan2( d.x, d.y ) / 3.1415926 * 180);

	} else {

		angularSpeed = image == 15 || image == 106 ? 1440 : 720;

	}
	
	PosTweener tweener = new PosTweener( this, dest, d.length() / SPEED );
	tweener.listener = this;
	parent.add( tweener );
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:30,代码来源:MissileSprite.java

示例6: reset

import com.watabou.utils.PointF; //导入方法依赖的package包/类
public void reset( int from, int to, int image, Glowing glowing, Callback listener ) {
	revive();
	
	view( image, glowing );
	
	this.callback = listener;

	point( DungeonTilemap.tileToWorld( from ) );
	PointF dest = DungeonTilemap.tileToWorld( to );
	
	PointF d = PointF.diff( dest, point() ); 
	speed.set( d ).normalize().scale( SPEED );
	
	if (image == 31 || image == 108 || image == 109 || image == 110) {

		angularSpeed = 0;
		angle = 135 - (float)(Math.atan2( d.x, d.y ) / 3.1415926 * 180);
		
	} else {
		
		angularSpeed = image == 15 || image == 106 ? 1440 : 720;
		
	}
	
	PosTweener tweener = new PosTweener( this, dest, d.length() / SPEED );
	tweener.listener = this;
	parent.add( tweener );
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:29,代码来源:MissileSprite.java


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