 /**
  *  GameSprite contains the Sprite class for the Epsilon game.
  *  Epsilon is a simple space-shooter-vertical-scroller game.
  *
  *  Epsilon is available for non-commercial use only!
  *  You can learn from this sources and you can modify them
  *  for learning purposes.
  * 
  *  @author      Ziga Hajdukovic
  *  @version     1.0
  */  

import javax.microedition.lcdui.*;

class GameSprite {

	public int x;
	public int y;
	
	public int w;
	public int h;

	public int vx;
	public int vy;
	
	public byte energy;
	public byte energyMax;
	
	public Image img;

	GameSprite(Image loaded_image, byte energy_max)
	{
		img = loaded_image;
		w = loaded_image.getWidth();
		h = loaded_image.getHeight();
		vx = 4;
		vy = 4;
		energyMax = energy_max;
		energy = energyMax;
	}

	public boolean collidesWith(GameSprite sprite)
	{
		return (x+w > sprite.x) && (x < sprite.x + sprite.w) &&
				(y+h > sprite.y) && (y < sprite.y + sprite.h);
	}
}

