java.lang.Object 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 |
---|
public int height
java.awt.Image img
public int width
public int x
public int y
Constructor Detail |
---|
public Sprite(int x, int y, int width, int height)
public Sprite(int x, int y, int width, int height, java.lang.String filename)
Method Detail |
---|
public void drawImage(java.awt.Graphics g)
public boolean isCollision(Sprite otherSprite)
public static boolean isCollision(Sprite s1, Sprite s2)