Lesson 14 - Sound add

Student would like to make it play the coin sound when guano scale changes from 4 to 0 and only when it changes. Not when it is equal to 0. Can someone help?

Thank you

Use a variable to store the previous scale, at the end of each loop check whether the previous scale was 4 and the current scale is 0.
https://studio.code.org/projects/gamelab/t18Av5-Ctjfh_wB8t-KpGiua4Zh9eB8-7A-3tXhliaU

However this is extremely counter intuitive as you should just set the visiblity of guano to false.

1 Like

@burnsk, Were you able to get it to work? Let us know if you still need any assistance on it.

Thanks!

Mike

@mwood Yes thanks so much, the student was happy to see it work as they were hoping.

1 Like