GitList
Repositories
Help
Report an Issue
puyopuyo
Code
Commits
Branches
Tags
Search
Tree:
2419458
Branches
Tags
master
puyopuyo
puyo.java
adding puyopuyo code.
Dev
commited
2419458
at 2018-07-21 10:16:11
puyo.java
Blame
History
Raw
/* * puyo.java * * Created on 16 April, 2007, 3:00 AM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ import java.awt.Image; import javax.swing.ImageIcon; /** * Creates a puyo object that holds all the its properties- * the image representing the puyo, logical x and y positions (in array {@link puyopuyo.backEnd#boardMap boardMap}) * and a character representing the color of the puyo. * @author Dev Ghai */ public class puyo{ /** * Creates a new puyo and associates image file <b>filename</b> to the puyo * and sets its color to <b>c</b>. * @param filename File name of the image that has to be associated with the puyo. * @param c Color of the puyo * <p>Following are its possible values: * <ul> * <li>'r' - Red</li> * <li>'g' - Green</li> * <li>'b' - Blue</li> * <li>'y' - Yellow</li> * </ul> */ public puyo(String filename, char c){ image = new ImageIcon(filename).getImage(); x=0; y=0; color = c; } /** * Creates a default puyo without assigning any image or color to it. */ public puyo(){} /** * Holds the image that represents the puyo. */ private Image image; /** * Returns the image associated with the puyo. */ public Image getImage(){ return image; } /** * Holds the X-Co-ordinate of the puyo in {@link puyopuyo.backEnd#boardMap} */ private int x; /** * Returns the X-Co-ordinate of the puyo in {@link puyopuyo.backEnd#boardMap boardMap}. */ public int getX(){ return x; } /** * Sets the X-Co-ordinate of the puyo in {@link puyopuyo.backEnd#boardMap boardMap} to xPos. * @param xPos New x position of puyo in {@link puyopuyo.backEnd#boardMap boardMap}. */ public void setX(int xPos){ x = xPos; } /** * Holds the Y-Co-ordinate of the puyo */ private int y; /** * Returns the Y-Co-ordinate of the puyo in the {@link puyopuyo.backEnd#boardMap boardMap} */ public int getY(){ return y; } /** * Sets the Y-Co-ordinate of the puyo in {@link puyopuyo.backEnd#boardMap boardMap} to yPos. * @param yPos New y position of puyo in {@link puyopuyo.backEnd#boardMap boardMap}. */ public void setY(int yPos){ y = yPos; } /** * Holds the color of the puyo. The color is stored first letter of the color string. * For example 'r' is stored for red. */ private char color; /** * Returns the color of the puyo - * <ul> * <li>'r' - Red</li> * <li>'g' - Green</li> * <li>'b' - Blue</li> * <li>'y' - Yellow</li> * </ul> */ public char getColor(){ return color; } }