/**
 * 
 */
package snake;

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.Random;

/**
 * @author Aaron
 *
 */
public class Food {
	private int x;
	private int y;
	
	private Random random = new Random();

	/**
	 * 
	 */
	public Food() {
		x = random.nextInt(Grid.WIDTH);
		y = random.nextInt(Grid.HEIGHT);
	}
	
	/**
	 * 
	 * @param g2d
	 */
	public void render(Graphics2D g2d){
		g2d.setColor(Color.RED);
		g2d.fillOval(x * (GamePanel.WIDTH / Grid.WIDTH), y * (GamePanel.HEIGHT / Grid.HEIGHT), GamePanel.WIDTH / Grid.WIDTH, GamePanel.HEIGHT / Grid.HEIGHT);
	}
	
	/**
	 * This method regenerates a new random food.
	 */
	public void regen(){
		x = random.nextInt(Grid.WIDTH);
		y = random.nextInt(Grid.HEIGHT);
	}
	
	/**
	 * 
	 * @return
	 */
	public int getX(){
		return x;
	}
	
	/**
	 * 
	 * @return
	 */
	public int getY(){
		return y;
	}

}

@@ -37,21 +37,26 @@
 ava.awt.
-Color
+Graphics2D
 ;%0Aimport
@@ -61,34 +61,43 @@
 rt java.awt.
-Graphics2D
+image.BufferedImage
 ;%0Aimport jav
@@ -237,107 +237,1136 @@
 ();%0A
+%09
 %0A%09
-/**%0A%09 * %0A%09 */%0A%09public Food() %7B%0A%09%09x = random.nextInt(Grid.WIDTH);%0A%09%09y = random.nextInt(Grid.HEIGHT
+private Sprite sprites = new Sprite(%22/fruit.png%22, 16, 16);%0A%09private BufferedImage%5B%5D pearFrames = %7Bsprites.getSprite(0, 0)%7D;%0A%09private BufferedImage%5B%5D strawberryFrames = %7Bsprites.getSprite(1, 0)%7D;%0A%09private BufferedImage%5B%5D orangeFrames = %7Bsprites.getSprite(2, 0)%7D;%0A%09private BufferedImage%5B%5D cherryFrames = %7Bsprites.getSprite(0, 1)%7D;%0A%09private BufferedImage%5B%5D lemonFrames = %7Bsprites.getSprite(1, 1)%7D;%0A%09private BufferedImage%5B%5D watermelonFrames = %7Bsprites.getSprite(2, 1)%7D;%0A%09private BufferedImage%5B%5D bananaFrames = %7Bsprites.getSprite(0, 2)%7D;%0A%09private BufferedImage%5B%5D blueberryFrames = %7Bsprites.getSprite(1, 2)%7D;%0A%09private BufferedImage%5B%5D appleFrames = %7Bsprites.getSprite(2, 2)%7D;%0A%09%0A%09private Animation%5B%5D animations = %7B%0A%09%09%09new Animation(pearFrames, 250),%0A%09%09%09new Animation(strawberryFrames, 250),%0A%09%09%09new Animation(orangeFrames, 250),%0A%09%09%09new Animation(cherryFrames, 250),%0A%09%09%09new Animation(lemonFrames, 250),%0A%09%09%09new Animation(watermelonFrames, 250),%0A%09%09%09new Animation(bananaFrames, 250),%0A%09%09%09new Animation(blueberryFrames, 250),%0A%09%09%09new Animation(appleFrames, 250)%09%0A%09%7D;%0A%09%0A%09private Animation animation;%0A%09%0A%09/**%0A%09 * %0A%09 */%0A%09public Food() %7B%0A%09%09regen(
 );%0A%09
@@ -1446,44 +1446,41 @@
 g2d.
-setColor(Color.RED);%0A%09%09g2d.fillOval(
+drawImage(animation.getSprite(), 
 x * 
@@ -1553,68 +1553,12 @@
 T), 
-GamePanel.WIDTH / Grid.WIDTH, GamePanel.HEIGHT / Grid.HEIGHT
+null
 );%0A%09
@@ -1709,16 +1709,81 @@
 EIGHT);%0A
+%09%09animation = animations%5Brandom.nextInt(animations.length - 1)%5D;%0A
 %09%7D%0A%09%0A%09/*

Add fruits