RecklessDarph

Extra Entity

Jul 13th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. package jumpingalien.model;
  2.  
  3. import jumpingalien.util.Sprite;
  4.  
  5. public class Entity {
  6.  
  7. private double World_Width= 10.24;
  8. private double World_Height= 7.68;
  9.  
  10. public double[] ActualPositon;
  11. public double[] getActualPosition() {
  12. return ActualPositon;
  13. }
  14.  
  15. public void changeActualPosition(double[] newPosition) throws Exception {
  16. if(newPosition[1] <0 || newPosition[0] <0) {throw new Exception("A or both positions are negative");}
  17. if(newPosition[0]>World_Width || newPosition[1]> World_Height) {throw new Exception("A or both positions is bigger than world dimentions");}
  18. else if(Double.isNaN(newPosition[0]) ||Double.isNaN(newPosition[0])) {throw new Exception("Invalid input type");}
  19. else if(newPosition.length != 2) {throw new Exception("Invalid size of Position");}
  20. else{this.ActualPositon = newPosition;}
  21. }
  22.  
  23. public int[] PixelPosition;
  24. public int[] getPixelPosition() {
  25. int[] newPixelPosition= {(int) (getActualPosition()[0]*100),(int) (getActualPosition()[1]*100)};
  26. return newPixelPosition ;
  27. }
  28.  
  29. public void setActualPositon(double x, double y) throws Exception {
  30. if(x <0 || y <0) {throw new Exception("A or both positions are negative");}
  31. else if(Double.isNaN(x) ||Double.isNaN(y)) {throw new Exception("Invalid input type");}
  32. else{double[] actualPositon= {x,y};
  33. ActualPositon = actualPositon;}
  34. }
  35.  
  36. public void setPixelPosition(int x, int y) throws Exception {
  37. if(x <0 || y <0) {throw new Exception("A or both positions are negative");}
  38. else{
  39. int[] newPositon= {x,y};
  40. PixelPosition = newPositon;}
  41. }
  42.  
  43. private int Orientation=0;
  44. public int getOrientation() {
  45. return Orientation;
  46. }
  47.  
  48. public void setOrientation(int currentOrientation) {
  49. }
  50.  
  51. public double[] Velocity = {0,0};
  52. public double[] getVelocity() {
  53. return this.Velocity;
  54. }
  55.  
  56. public void setVelocity(double x, double y) {
  57. double[] velocity= {x,y};
  58. Velocity = velocity;
  59. }
  60.  
  61. public void startMoveLeft() throws Exception {
  62. }
  63.  
  64. public void startMoveRight() throws Exception {
  65. }
  66.  
  67. public void advanceTime(double time) throws Exception {
  68. }
  69.  
  70. public void setCurrentSprite(Sprite currentSprite) {
  71. }
  72.  
  73. public Sprite getCurrentSprite() {
  74. return null;
  75. }
  76.  
  77. public World CurrentWorld;
  78. public World getWorld() {
  79. return null;
  80. }
  81.  
  82. public void setWorld(World world) {
  83. CurrentWorld=world;
  84. }
  85.  
  86. public void setHitPoint(int hitpoint) {
  87.  
  88. }
  89.  
  90. public double[] Acceleration = {0,0};
  91. public double[] getAcceleration() {
  92. return null;
  93. }
  94.  
  95. public boolean IsDead;
  96. public boolean isDeadGameObject() {
  97. return IsDead;
  98. }
  99.  
  100. public boolean IsTerminated;
  101. public boolean isTerminatedGameObject() {
  102. return IsTerminated;
  103. }
  104.  
  105. public void terminateGameObject() {
  106.  
  107. }
  108.  
  109. public int getHitpoint() {
  110. // TODO Auto-generated method stub
  111. return 0;
  112. }
  113.  
  114. public Sprite[] getSprites() {
  115. // TODO Auto-generated method stub
  116. return null;
  117. }
  118. }
Advertisement
Add Comment
Please, Sign In to add comment