p1.addComponent(new MouseFollowerComponent());
p1.addComponent(new CollisionComponent(new CircularCollisionMask(25)));
p1.addComponent(new OrientationComponent(-100));
final SpinComponent spin = new SpinComponent(0.1f);
//p1.addComponent(spin);
EventSystem.getInstance().registerEventListener(new EventListener() {
private int button;
@Override
public void onEvent(Event e) {
int b = ((MousePressedEvent) e).getButton();
if(b != button){
spin.setValue(-spin.getValue());
button = b;
}
p1.addComponent(spin);
}
@Override
public int getUniqueID() {
return 0;
}
@Override
public String getType() {
return "Custom";
}
}, "MousePressed", null);
EventSystem.getInstance().registerEventListener(new EventListener() {
@Override
public void onEvent(Event e) {
p1.removeComponent(spin);
}