My basket can only move 1 place to the right and only 1 place to the left somehow. It worked perfectly before.
Link to video: https://youtu.be/IE06qsapL2k
My basket can only move 1 place to the right and only 1 place to the left somehow. It worked perfectly before.
Link to video: https://youtu.be/IE06qsapL2k
You have created multiple baskets, which causes the problems.
Remove lines 19, 81,82 and 83 in DrawingPanel.java (the lines that created more than one basket).
Other suggestions if basket is not moving:
Does the print-statement System.out.println(...)
in the keyPressed() eventhandler print the values in the Console?
Add similar print-statements to the left() and right() methods of DrawingPanel to see if they work properly, eg:
System.out.println("left");
Check the paintComponent() method. Are if-statements properly closed? (Format the code with right-click > Source > Format) Sometimes the for-loop which draws the gameElements ends-up inside one of the if-statements...
Also, double-check you did all the step as outlined under "Moving basket" in the assignment.