@Override
public int getValues(ZombieParticle target, int tweenType, float[] returnValues) {
switch (tweenType) {
case POSITION_X: returnValues[0] = target.getX(); return 1;
case POSITION_Y: returnValues[0] = target.getY(); return 1;
case POSITION_XY:
returnValues[0] = target.getX();
returnValues[1] = target.getY();
returnValues[2] = target.getColor().a;
return 2;
default: assert false; return -1;
}
}
@Override
public void setValues(ZombieParticle target, int tweenType, float[] newValues) {
switch (tweenType) {
case POSITION_X: target.setX(newValues[0]); break;
case POSITION_Y: target.setY(newValues[0]); break;
case POSITION_XY:
target.setX(newValues[0]);
target.setY(newValues[1]);
Color c = target.getColor();
c.set(c.r, c.g, c.b, newValues[2]);
target.setColor(c);
break;
default: assert false; break;
}
}
Tween.to(dust1, ZombieParticleAccessor.POSITION_XY, 0.5f)
.targetRelative(MathUtils.random(0.5f, 1.5f), MathUtils.random(0.1f, 1.2f), 0)
.ease(Circ.OUT)
.start(tweenManager);
List<ZombieParticle> zombieParticles = new ArrayList<ZombieParticle>();Tween.to(dust1, ZombieParticleAccessor.POSITION_XY, 1f)
.setCallback(new TweenCallback() {
@Override public void onEvent(int type, BaseTween<?> source) {
// remove target in the list once tween is completed
zombieParticles.remove((ZombieParticle) source.getUserData());
}
})
.targetRelative(MathUtils.random(1f, 2f), MathUtils.random(0.1f, 1.5f), -0.5f)
.ease(Circ.OUT)
.start(tweenManager);
ZombieParticle target = ((Tween) source).getTarget();Return to Libgdx Contributions
Users browsing this forum: kalle_h and 2 guests