package engine.sprites;

import javafx.geometry.Point2D;
import engine.InsufficientParametersException;


/**
 * This represents the general class for all game elements. All elements will contain methods which
 * return a boolean indicating if another type is able to target or collide with it.
 * 
 * @author Qian Wang
 *
 */
public abstract class Sprite {
    private Point2D myLocation;
    private String myType;

    public Sprite () throws InsufficientParametersException {

    }

    // public abstract List<String> getParameters ();

    // public double getSize () {
    // return 0;
    // }

    // Setters and getters

    /**
     * Sets the location of the sprite
     * 
     * @param location Point2D object representing (x, y) coordinates
     */
    protected void setLocation (Point2D location) {
        myLocation = location;
    }

    /**
     * Sets the location of the sprite
     * 
     * @param x double of x-coordinate
     * @param y double of y-coordinate
     */
    protected void setLocation (double x, double y) {
        myLocation = new Point2D(x, y);
    }

    /**
     * Sets the type of object this is as an uppercase string
     * 
     * @param type String of the type of object
     */
    protected void setType (String type) {
        myType = type.toUpperCase();
    }

    /**
     * @return uppercase String of the type of object this is
     */
    protected String getType () {
        return myType;
    }

    // Abstract methods

    /**
     * Finds if a certain type of object can target this object
     * 
     * @param type String
     * @return true if the given type can target this object's type
     */
    public abstract boolean isTargetableBy (String type);

    /**
     * Finds if a certain type of object can collide with this object
     * 
     * @param type String
     * @return true if the given type can collide with this object's type
     */
    public abstract boolean isCollidableWith (String type);

}

@@ -18,16 +18,38 @@
 rites;%0A%0A
+import java.util.Map;%0A
 import j
@@ -72,16 +72,16 @@
 oint2D;%0A
-
 import e
@@ -372,16 +372,153 @@
 Sprite %7B
+%0A%0A    /**%0A     * Holds the parameters of each object, like health/power/defense/etc%0A     */%0A    private Map%3CString, Object%3E myParameters;
 %0A    pri
@@ -752,24 +752,24 @@
 ;%0A    // %7D%0A%0A
-
     // Sette
@@ -784,16 +784,535 @@
 etters%0A%0A
+    /**%0A     * Loads an map of strings of parameters names to the object that carries their value%0A     * %0A     * @param map of string to object%0A     */%0A    protected void setParameterMap (Map%3CString, Object%3E map) %7B%0A        myParameters = map;%0A    %7D%0A%0A    /**%0A     * Returns the specified parameter%0A     * %0A     * @param name String of the parameter%0A     * @return Object of a certain type representing value of name%0A     */%0A    protected Object getParameter (String name) %7B%0A        return myParameters.get(name);%0A    %7D%0A%0A
     /**%0A

Add parameters instance variables to all sprites