Advertisement
Guest User

Enemy

a guest
Mar 16th, 2013
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package OurGame;
  2.  
  3. import java.awt.*;
  4.  
  5. import javax.swing.ImageIcon;
  6.  
  7. public class Enemy {
  8.  
  9. Image img;
  10. int x, y;
  11. boolean isAlive = true;
  12.  
  13. public Enemy(int startX, int startY, String location)
  14. {
  15. x = startX;
  16. y = startY;
  17. ImageIcon l = new ImageIcon(location);
  18. img = l.getImage();
  19. }
  20. public int getX()
  21. {
  22. return x;
  23. }
  24. public int getY()
  25. {
  26. return y;
  27. }
  28. public boolean Alive()
  29. {
  30. return isAlive;
  31. }
  32. public Image getImage()
  33. {
  34. return img;
  35. }
  36.  
  37. public void move(int dx)
  38. {
  39.  
  40. x = x - dx;
  41. }
  42.  
  43. public Rectangle getBounds()
  44. {
  45. return new Rectangle(x,y, 73, 78);
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement