You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

38 regels
852 B

  1. package events;
  2. import com.fasterxml.jackson.databind.JsonNode;
  3. import akka.actor.ActorRef;
  4. import structures.GameState;
  5. /**
  6. * Indicates that the user has clicked an object on the game canvas, in this case a tile.
  7. * The event returns the x (horizontal) and y (vertical) indices of the tile that was
  8. * clicked. Tile indices start at 1.
  9. *
  10. * {
  11. * messageType = “tileClicked”
  12. * tilex = <x index of the tile>
  13. * tiley = <y index of the tile>
  14. * }
  15. *
  16. * @author Dr. Richard McCreadie
  17. *
  18. */
  19. public class TileClicked implements EventProcessor{
  20. @Override
  21. public void processEvent(ActorRef out, GameState gameState, JsonNode message) {
  22. int tilex = message.get("tilex").asInt();
  23. int tiley = message.get("tiley").asInt();
  24. if (gameState.something == true) {
  25. // do some logic
  26. }
  27. }
  28. }