0

I created a bouncing ball game in scratch for CS50 PSET0.
1] The game works well as I expected, except for the following bug/errors:

  1. The game can be paused by pressing the UP Arrow key on the keyboard, even BEFORE it is started or AFTER the game is over. THIS SHOULD ONLY WORK WHEN A LEVEL HAS BEEN SELECTED AND GAME STARTED AND NOT BEFORE OR AFTER IT IS STARTED. [WORKING ON IT]

  2. I set the Paddle dragmode to not draggable, yet it's not working as you can still drag the paddle using the mouse. [SOLVED]

  3. Falling eggs/bomb won't stop falling when the game is over or paused. [TRYING TO SOLVE IT BROUGHT A NEW BUG] One egg appears at the bottom of the screen after I paused and resume the game. I'm not sure how to hide that one stubborn egg.

  4. On hitting the paddle or edge, the ball bouncing isn't very smooth and natural. It sometimes lag. [WORKING ON IT]

  5. JUST CURIOUS: Why is the code "when I receive Setting btn Clicked" not working on the sound and music button sprite? [SOLVED]

I will appreciate all your kind suggestions.

Here's my project

NB: if the question seems unclear and you tend to understand it. Kindly feel free to suggest an edit. Thanks.

1 Answers1

1
  1. For point 1, you could test with an if statement whether the game is currently running. (Using the same variable you use to pause the game.)

  2. As for the dragging of the paddle, I can't seem to drag it. That is, I can't drag it when I am playing, but I can when in the editor. This is always the case, you can drag any sprite around while editing, but not when playing without the editor open. This is the default behaviour of sprites as well, you do not have to declare it each time. A reason for you to want to drag sprites is when you use the Pen Extension to create a drawing program.

  3. To stop the eggs from falling, you could pause the clones the same way you pause the ball when moving.

  4. To let the ball turn more smoothly you could let it turn between an angle from -90° to 90° opposite to the surface it hits. To implement this would be quite difficult with a single line. You could, if you don't mind it hitting the edge instead of the border you built, split it so you include the built-in block: if on edge, bounce. The if-statement would then only include the touching of the paddle (and maybe the danger bar). In this statement, you would select an angle between -90 and 90 degrees.

  5. For 5, there must've gone something wrong when you wanted to design this, the when I receive [setting btn clicked v] block is just not connected. :)

anderium
  • 194
  • 5
  • 11
  • Thanks Anderium.. 1, 2, 4, 5 is now resolved. However, for 3 (falling eggs) putting it within the pause/play function works except that One egg appears on the bottom of the window when I pause and resume the game. I can't figure out how to make that one egg disappear when game's resumed. Could you help. Thanks – KeleosWilliam Nov 17 '19 at 09:16
  • I think that egg is the original, not a clone. I think I found a way to solve it! :) You could add a `hide` block after the `wait until <>` block. When you would resume, it would hide immediately again. – anderium Nov 17 '19 at 10:44
  • Thanks again @Anderium for your help. I added the `**hide block**` after the `**wait until **` but this seem to work for Level 1 and 2 only, **The sprite refuse to** to hide from level 3 upward. – KeleosWilliam Nov 17 '19 at 20:17
  • I see… That's probably because it has a wait 5 sec. block in the loop… I have no clue how you could solve this, sorry – anderium Nov 18 '19 at 09:04