@xxxcoolboyxxx - yes that worked! although now....whatever button i press my character .jpg goes to the left. :/ The code logic looks like it would not do this though.
I think its not detecting that you already have an actionPerformed method, and when you click "add unimplemented methods", it adds another actionPerformed method (even though there is already one in there (with p.move()).
Maybe keep the actionPerformed method it creates and add the two lines in there from the other preexisting method. See if that works.
This has been flagged as spam show
why it doest work to me??please help me
public void paint(Graphics2D g){
super.paint(g);
Graphics2D g2= (Graphics2D) g; g2.drawImage(back,0,0,null);
g2.drawImage(img.getImage(),img.getX(), img.getY(),null); }
how become public void paint(Graphics2D g){
why public void paint(Graphics2D g){
overrides even if there are no other class using public void paint?please answer..i needed please
xxxjoanxxx1 1 year ago
@xxxcoolboyxxx - yes that worked! although now....whatever button i press my character .jpg goes to the left. :/ The code logic looks like it would not do this though.
MrMisanthropy 1 year ago
@MrMisanthropy To make sure that the character doesnt only move to the left, the if statements in the dude class must look like this:
if(key == KeyEvent.VK_LEFT){ dx = -1; } if(key == KeyEvent.VK_RIGHT){ dx = +1; }
SCARHExtendedMags 7 months ago
I think its not detecting that you already have an actionPerformed method, and when you click "add unimplemented methods", it adds another actionPerformed method (even though there is already one in there (with p.move()).
Maybe keep the actionPerformed method it creates and add the two lines in there from the other preexisting method. See if that works.
xxxcoolboyxxx 1 year ago