0

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

Share a link to this question (includes your user id)
| edit | | close | delete |
0

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).

Share a link to this answer (includes your user id)
| edit | delete |
0

Send me the complete Ecplise project folder in a zip-file, so I can have a look.

Share a link to this answer (includes your user id)
| edit | delete |
0

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.

Share a link to this answer (includes your user id)
| edit | delete |

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.