shield.java
Upload User: jhzhutan
Upload Date: 2021-03-28
Package Size: 374k
Code Size: 1k
Category:

Shot Game

Development Platform:

Java

  1. //Download:http://www.codefans.net
  2. import java.awt.*;
  3. public class shield implements Actor{
  4. public int xPos;
  5. public int yPos;
  6. public ClientModel gameModel;
  7. public String Type = "shield";
  8. public shield(int xPos, int yPos,  ClientModel gameModel){
  9. this.xPos = xPos;
  10. this.yPos = yPos;
  11. this.gameModel = gameModel;
  12. }
  13. public void draw(Graphics g){
  14. g.setColor(Color.red);
  15. g.drawRect(xPos - 12, yPos - 12, 25,25);
  16. g.drawRect(xPos - 11, yPos - 11, 23,23);
  17. gameModel.removeActor(this);
  18. }
  19. public int getxPos(){
  20. return xPos;
  21. }
  22. public int getyPos(){
  23. return yPos;
  24. }
  25. public String getType(){
  26. return Type;
  27. }
  28. }