Class Sprite

java.lang.Object
  extended by Sprite

To use this class, see here:

Field Summary
 int height
           
(package private)  java.awt.Image img
           
 int width
           
 int x
           
 int y
           
 
Constructor Summary
Sprite(int x, int y, int width, int height)
          To create a sprite that is not an image
Sprite(int x, int y, int width, int height, java.lang.String filename)
          To create a sprite with an image (saved in your bluej project folder
 
Method Summary
 void drawImage(java.awt.Graphics g)
          To draw the sprite (if its an image) on what graphics layer you want
 void drawImage(java.awt.Graphics g, String filename)
          To draw the filename on what graphics layer you want
 boolean isCollision(Sprite otherSprite)
          To check if there is a collission between this sprite and another one.
static boolean isCollision(Sprite s1, Sprite s2)
          To check if there is a collission between two sprites returns true if there is a collission and false otherwise you would call it like: if (Sprite.isCollision(mario, luigi))
void playSound(String filename)
           will play a .wav .au file located in your home directory
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

height

public int height

img

java.awt.Image img

width

public int width

x

public int x

y

public int y
Constructor Detail

Sprite

public Sprite(int x,
              int y,
              int width,
              int height)
To create a sprite that is not an image


Sprite

public Sprite(int x,
              int y,
              int width,
              int height,
              java.lang.String filename)
To create a sprite with an image (saved in your bluej project folder

Method Detail

drawImage

public void drawImage(java.awt.Graphics g)
To draw the sprite (if its an image) on what graphics layer you want


isCollision

public boolean isCollision(Sprite otherSprite)
To check if there is a collission between this sprite and another one. returns true if there is a collission and false otherwise


isCollision

public static boolean isCollision(Sprite s1,
                                  Sprite s2)
To check if there is a collission between two sprites returns true if there is a collission and false otherwise you would call it like: if (Sprite.isCollision(mario, luigi))