Commit 0e54dc96 authored by nargessalehi98's avatar nargessalehi98

Add javadoc.

parent 10925a5f
...@@ -4,20 +4,34 @@ import java.awt.image.BufferedImage; ...@@ -4,20 +4,34 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
/**
* keep prize info
* @author narges salehi & sepehr tavakoli
* @version 1.1
* @since July 21 2020
*/
public class Prize { public class Prize {
//x of prize
int x; int x;
//y of prize
int y; int y;
//width of prize
int width; int width;
//height of prize
public boolean CheckExpiration() {
return checkExpiration;
}
int height; int height;
//name of prize
String name; String name;
boolean checkExpiration=false;
/**
* creat a new prize
* @param x of prize
* @param y of prize
* @param width pof prize
* @param height of prize
* @param name of prize
*/
public Prize(int x, int y, int width, int height, String name) { public Prize(int x, int y, int width, int height, String name) {
//set given value to constructor as default value
this.x = x; this.x = x;
this.y = y; this.y = y;
this.width = width; this.width = width;
...@@ -25,60 +39,45 @@ public class Prize { ...@@ -25,60 +39,45 @@ public class Prize {
this.name = name; this.name = name;
} }
/**
*
* @return x of prize
*/
public int getX() { public int getX() {
return x; return x;
} }
/**
*
* @return y of tank
*/
public int getY() { public int getY() {
return y; return y;
} }
/**
*
* @return width of prize
*/
public int getWidth() { public int getWidth() {
return width; return width;
} }
/**
*
* @return name of prize
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
*
* @return height of prize
*/
public int getHeight() { public int getHeight() {
return height; return height;
} }
// public static void setPrize(GameFrame gameFrame, Graphics2D g2d){
// int randomLoc = (int) (Math.random() * (gameFrame.realMapSize));
// int randomNum = (int) (Math.random() * (5));
//
// if (randomLoc % 2 != 0)
// randomLoc = randomLoc - 1;
// if (gameFrame.firstPrize) {
// g2d.drawImage(gameFrame.bullet2, gameFrame.prizeLoc.get(randomLoc), gameFrame.prizeLoc.get(randomLoc + 1), null);
// gameFrame.firstPrize = false;
// gameFrame.lastX = gameFrame.prizeLoc.get(randomLoc);
// gameFrame.lastY = gameFrame.prizeLoc.get(randomLoc + 1);
// gameFrame.renderCountLimit = gameFrame.renderCount + 90;
// gameFrame.lastPrize = gameFrame.bullet2;
// } else if (gameFrame.renderCount != gameFrame.renderCountLimit) {
// g2d.drawImage(gameFrame.lastPrize, gameFrame.lastX, gameFrame.lastY, null);
// } else {
// if(randomNum==1) {
// g2d.drawImage(gameFrame.shield, gameFrame.prizeLoc.get(randomLoc), gameFrame.prizeLoc.get(randomLoc + 1), null);
// gameFrame.lastPrize = gameFrame.shield;
// } if(randomNum==0) {
// g2d.drawImage(gameFrame.life, gameFrame.prizeLoc.get(randomLoc), gameFrame.prizeLoc.get(randomLoc + 1), null);
// gameFrame.lastPrize = gameFrame.life;
// } if(randomNum==3) {
// g2d.drawImage(gameFrame.bullet3, gameFrame.prizeLoc.get(randomLoc), gameFrame.prizeLoc.get(randomLoc + 1), null);
// gameFrame.lastPrize = gameFrame.bullet3;
// } if(randomNum==2) {
// g2d.drawImage(gameFrame.laser, gameFrame.prizeLoc.get(randomLoc), gameFrame.prizeLoc.get(randomLoc + 1), null);
// gameFrame.lastPrize = gameFrame.laser;
// } if(randomNum==4) {
// g2d.drawImage(gameFrame.bullet2, gameFrame.prizeLoc.get(randomLoc), gameFrame.prizeLoc.get(randomLoc + 1), null);
// gameFrame.lastPrize = gameFrame.bullet2;
// }
// gameFrame.lastX = gameFrame.prizeLoc.get(randomLoc);
// gameFrame.lastY = gameFrame.prizeLoc.get(randomLoc + 1);
// gameFrame.renderCountLimit = gameFrame.renderCount + 90;
// }
// }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment