Skip to content

Instantly share code, notes, and snippets.

@7yl4r
Created June 6, 2015 14:32
Show Gist options
  • Save 7yl4r/5e50f3a5e90fcf796abf to your computer and use it in GitHub Desktop.
Save 7yl4r/5e50f3a5e90fcf796abf to your computer and use it in GitHub Desktop.
public class WeaponListener implements BaseComponentListener {
@Override
public void run(BaseComponent comp, BaseComponentMessage msg, ListenableData data) {
ShootToMessage shootTo = (ShootToMessage) msg;
WeaponComponent wc = (WeaponComponent) comp;
// access to the player position
float x = data.x;
float y = data.y;
float angle = 0;
wc.shoot(angle);
}
@Override
public boolean validate(BaseComponentMessage msg) {
return msg instanceof ShootToMessage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment