so i have two class.
1 = Main.java - 2 = Player.java
AND
my folder tree
-src
-images
player_walk_right.gif
-Main.java
-Player.java
Player.java
public class Player
{
Image player_image = getImage(getDocumentBase(),"player_walk_right.gif");
/*** constructor Method ***/
public Player()
{
//empty constructor
}
public Player(int ix, int iy)
{
x = ix;
y = ix;
}
/*** get/set method ***/
public Image getImages()
{ return player_image; }
/*** paint method ***/
public void paint(Graphics g)
{
g.drawImage(player_image, 0, 0, null);
}/*** paint method ***/
}/*** end of class ***/
Main.java :
public class Main extends Applet implements Runnable
{
/*** start method ***/
@Override
public void start()
{
player_class = new Player();
Thread thread = new Thread(this);
thread.start();
}/*** end of start method ***/
/*** run method ***/
public void run()
{
while(true) //player moves
{
player_class.update(this);
repaint();
try
{
Thread.sleep(17);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
}/*** end of run method ***/
/*** paint method ***/
@Override
public void paint(Graphics g)
{
player_class.paint(g); //call Player class, which will draw player
}/*** end of paint method ***/
}
error - The method getDocumentBase() is undefined for the type Player
any ides's?????