0

Am completely new to programming and trying to experiment a bit with Scratch as part of week 0.

So far lots of fun. But now I am facing a problem:

Aim is to not get eaten by sharks. I have created a variable called "Deaths" which is counting number of times fish touches shark. Now I have coded an if condition with 'if death=3 then broadcast "Game Over"' But somehow all statements I have written for when 'received "Game Over"' are not working...for example 'stop all' (for stopping all movement etc.). Also, a plain "play sound" is not working (see stage!).

I have been trying to figure it out for the past hour and I seem to not find a solution. Help is very much appreciated :-)

Amir

http://scratch.mit.edu/projects/50386226/

  • Your scratch project is not public right now, you need to share it to allow others to see its content. – wallek876 Mar 3 '15 at 15:11
  • oh thanks for the hint!! it should now be public scratch.mit.edu/projects/50386226 – Amir Mar 3 '15 at 22:01
1

It looks like you have the command to stop the script when Game Over is heard in more than one place (on Shark2, Fish2 and the stage) so you're probably having problems with one sprite ending the entire script before another one has finished all of its instructions; like changing colour for example. Since 'stop all' kills everything as soon as it is executed, you'll only need it in one place - ideally at the end of everything else you want to happen first.

Also, if you're telling the program to play a sound, but that sound isn't loaded in the sound menu, the program won't be able to play it. It would be like me asking you to play that song my brother just released - you have no idea who my brother is, nor do you have the song available even if you did know him. Make sure to check and fix any links you have to sounds when you delete them, or ensure that the sounds you're trying to play are all loaded correctly - I think this might just be an occasional bug in Scratch; I've run into it a couple times.

  • Thanks for your thorough answer. This helped me alot. Unfortunately, the sound is still not playing and the broadcasting of "GAME OVER" still not working even though I did the changes. Do you mind taking a second look? Otherwise, I guess you are right and it might really be a bug! Thanks! – Amir Mar 4 '15 at 19:16
  • You're welcome! I think the biggest problem you're having right now stems from the set of commands that broadcasts Game Over. It's important to remember that an if statement does not loop on its own. It will check if that argument is true, do one of two things depending on if it is true or false, and then keeps going down the list of instructions. If there's nothing else in the list, then it does nothing until you restart the program. – Kalem Mar 5 '15 at 4:03
  • Great Kalem. Thanks for all your help! The 'game' is now roughly. There are some minor things I'd like to change but maybe next time, now it's time for C :-) – Amir Mar 6 '15 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .