Anonymous Anonymous - 1 month ago
274 0

No description

Java

chessaf3

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Jenn Joss
 */
public class ChessPiece implements ChessItems{
    
    String name;
    int x;
    int y;
    int pos;
    int size;

    public ChessPiece(String name, int x, int y, int size){
        setItem(name);
        setPosition(x, y);
        setSize(size);
    }
            
    @Override
    public void setItem(String name) {
        this.name = name;
    }
    
    

    @Override
    public void setPosition(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public int returnPosition() {
        return x*size+y;
    }

    @Override
    public void setSize(int size) {
        this.size = size;
    }
    
    public String toString(){
        return name;
    }
}