armark1ng

Untitled

Jun 25th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. package com.rs.game;
  2.  
  3. import com.rs.utils.Utils;
  4.  
  5. public class ForceMovement {
  6.  
  7. public static final int NORTH = 0, EAST = 1, SOUTH = 2, WEST = 3, NORTH_EAST = 4, NORTH_WEST = 5, SOUTH_WEST = 6,
  8. SOUTH_EAST = 7;
  9.  
  10. private WorldTile toFirstTile;
  11. private WorldTile toSecondTile;
  12. private int firstTileTicketDelay;
  13. private int secondTileTicketDelay;
  14. protected int direction;
  15.  
  16. /*
  17. * USE: moves to firsttile firstTileTicketDelay: the delay in game tickets
  18. * between your tile and first tile the direction
  19. */
  20. public ForceMovement(WorldTile toFirstTile, int firstTileTicketDelay, int direction) {
  21. this(toFirstTile, firstTileTicketDelay, null, 0, direction);
  22. }
  23.  
  24. /*
  25. * USE: moves to firsttile and from first tile to second tile
  26. * firstTileTicketDelay: the delay in game tickets between your tile and
  27. * first tile secondTileTicketDelay: the delay in game tickets between first
  28. * tile and second tile the direction
  29. */
  30. public ForceMovement(WorldTile toFirstTile, int firstTileTicketDelay, WorldTile toSecondTile,
  31. int secondTileTicketDelay, int direction) {
  32. this.toFirstTile = toFirstTile;
  33. this.firstTileTicketDelay = firstTileTicketDelay;
  34. this.toSecondTile = toSecondTile;
  35. this.secondTileTicketDelay = secondTileTicketDelay;
  36. this.direction = direction;
  37. }
  38.  
  39. public int getDirection() {
  40. switch (direction) {
  41. case NORTH:
  42. return Utils.getFaceDirection(0, 1);
  43. case EAST:
  44. return Utils.getFaceDirection(1, 0);
  45. case SOUTH:
  46. return Utils.getFaceDirection(0, -1);
  47. case NORTH_EAST:
  48. return Utils.getFaceDirection(1, 1);
  49. case NORTH_WEST:
  50. return Utils.getFaceDirection(-1, 1);
  51. case SOUTH_EAST:
  52. return Utils.getFaceDirection(1, -1);
  53. case SOUTH_WEST:
  54. return Utils.getFaceDirection(-1, -1);
  55. default:
  56. case WEST:
  57. return Utils.getFaceDirection(-1, 0);
  58. }
  59. }
  60.  
  61. public WorldTile getToFirstTile() {
  62. return toFirstTile;
  63. }
  64.  
  65. public WorldTile getToSecondTile() {
  66. return toSecondTile;
  67. }
  68.  
  69. public int getFirstTileTicketDelay() {
  70. return firstTileTicketDelay;
  71. }
  72.  
  73. public int getSecondTileTicketDelay() {
  74. return secondTileTicketDelay;
  75. }
  76.  
  77. }
Add Comment
Please, Sign In to add comment