本文整理汇总了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))
));
}
}
}
示例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);
}
}
示例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();
}
}
示例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));
}
}
}
示例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 ) );
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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 ) );
}
}
}
示例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;
}
示例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 );
}
示例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();
}
示例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 );
}
}