hello i am a softmore in highschool and am working on a project for my cs2 final project.
i have been able to read animated gifs into jframe but there is a problem in how the full background is displayed,
first it shows the center image how i want it too, with transparency, but there is a white border around the image that i can't seem to take off. can anyone help me?
here is some sample code:
class Player
{
public void draw(Graphics g)
{
if(walkRight && !walkLeft)
{
try{
image = Toolkit.getDefaultToolkit().getImage("kirby/kirbywalk.gif");
}catch(Exception e){out.println(e);}
}else if(walkLeft && ! walkRight)
{
try{
image = Toolkit.getDefaultToolkit().getImage("kirby/kirbywalk.gif");
}catch(Exception e){out.println(e);}
}
else
{
try{
image = Toolkit.getDefaultToolkit().getImage("kirby/kirby.gif");
}catch(Exception e){out.println(e);}
}
if(isAttacking)
{
attack--;
try{
image = Toolkit.getDefaultToolkit().getImage("kirby/kirbyattack.gif");
}catch(Exception e){out.println(e);}
if(attack/7 == 6||attack/7 == 7)
{
attackBounds = new Bounderies();
attackBounds.add(new MyLine(46+x,20+y,69+x,20+y));
attackBounds.add(new MyLine(69+x,20+y,92+x,40+y));
attackBounds.add(new MyLine(92+x,40+y,92+x,47+y));
attackBounds.add(new MyLine(92+x,47+y,53+x,67+y));
}else attackBounds = null;
}
if(attack == 0)
{
isAttacking = false;
}
g.drawImage(image,x,y,94,81,null);
}
}
and there is a JFrame class called Map that holds the player
the full source is here:
dragon.rar
can anyone help me?