use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.
the class MagicMissile method reset.
public void reset(int type, PointF from, PointF to, Callback callback) {
this.callback = callback;
revive();
x = from.x;
y = from.y;
width = 0;
height = 0;
PointF d = PointF.diff(to, from);
PointF speed = new PointF(d).normalize().scale(SPEED);
sx = speed.x;
sy = speed.y;
time = d.length() / SPEED;
switch(type) {
case MAGIC_MISSILE:
default:
size(4);
pour(WhiteParticle.FACTORY, 0.01f);
break;
case FROST:
pour(MagicParticle.FACTORY, 0.01f);
break;
case FIRE:
size(4);
pour(FlameParticle.FACTORY, 0.01f);
break;
case CORROSION:
size(3);
pour(CorrosionParticle.MISSILE, 0.01f);
break;
case FOLIAGE:
size(4);
pour(LeafParticle.GENERAL, 0.01f);
break;
case FORCE:
pour(SlowParticle.FACTORY, 0.01f);
break;
case BEACON:
pour(ForceParticle.FACTORY, 0.01f);
break;
case SHADOW:
size(4);
pour(ShadowParticle.MISSILE, 0.01f);
break;
case RAINBOW:
size(4);
pour(RainbowParticle.BURST, 0.01f);
break;
case FIRE_CONE:
size(10);
pour(FlameParticle.FACTORY, 0.03f);
break;
case FOLIAGE_CONE:
size(10);
pour(LeafParticle.GENERAL, 0.03f);
break;
}
}
use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Builder method angleBetweenRooms.
// returns the angle in degrees made by the centerpoints of 2 rooms, with 0 being straight up.
protected static float angleBetweenRooms(Room from, Room to) {
PointF fromCenter = new PointF((from.left + from.right) / 2f, (from.top + from.bottom) / 2f);
PointF toCenter = new PointF((to.left + to.right) / 2f, (to.top + to.bottom) / 2f);
return angleBetweenPoints(fromCenter, toCenter);
}
use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.
the class TunnelRoom method getDoorCenter.
// returns a point equidistant from all doors this room has
protected final Point getDoorCenter() {
PointF doorCenter = new PointF(0, 0);
for (Door door : connected.values()) {
doorCenter.x += door.x;
doorCenter.y += door.y;
}
Point c = new Point((int) doorCenter.x / connected.size(), (int) doorCenter.y / connected.size());
if (Random.Float() < doorCenter.x % 1)
c.x++;
if (Random.Float() < doorCenter.y % 1)
c.y++;
c.x = (int) GameMath.gate(left + 1, c.x, right - 1);
c.y = (int) GameMath.gate(top + 1, c.y, bottom - 1);
return c;
}
use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.
the class HallwayRoom method getDoorCenter.
// returns a point equidistant from all doors this room has
protected final Point getDoorCenter() {
PointF doorCenter = new PointF(0, 0);
for (Door door : connected.values()) {
doorCenter.x += door.x;
doorCenter.y += door.y;
}
Point c = new Point((int) doorCenter.x / connected.size(), (int) doorCenter.y / connected.size());
if (Random.Float() < doorCenter.x % 1)
c.x++;
if (Random.Float() < doorCenter.y % 1)
c.y++;
c.x = (int) GameMath.gate(left + 2, c.x, right - 2);
c.y = (int) GameMath.gate(top + 2, c.y, bottom - 2);
return c;
}
use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.
the class SewerPipeRoom method getDoorCenter.
// returns a point equidistant from all doors this room has
protected final Point getDoorCenter() {
PointF doorCenter = new PointF(0, 0);
for (Door door : connected.values()) {
doorCenter.x += door.x;
doorCenter.y += door.y;
}
Point c = new Point((int) doorCenter.x / connected.size(), (int) doorCenter.y / connected.size());
if (Random.Float() < doorCenter.x % 1)
c.x++;
if (Random.Float() < doorCenter.y % 1)
c.y++;
c.x = (int) GameMath.gate(left + 2, c.x, right - 2);
c.y = (int) GameMath.gate(top + 2, c.y, bottom - 2);
return c;
}
Aggregations