Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+11 votes

Here is my code that allows you to use both drums and other instruments!

extensions [sound]

;;turtles own an "instrument" and a "kind"
turtles-own [instrument kind]

to setup


cro 4
;;drum turtles
ask turtle 0 [set instrument "Bass Drum 1" set kind "drum"]
ask turtle 1 [set instrument "Low Tom" set kind "drum"]

;;instrument turtles
ask turtle 2 [set instrument "Marimba" set kind "pitched"]
ask turtle 3 [set instrument "Marimba" set kind "pitched"]


to go

ask turtles [

fd 1
right random 90
left random 90

;;check if the turtle is a drum or not
ifelse kind = "drum" [
  ;;plays a drum note
  sound:play-drum instrument (180 + pxcor)
  ;;plays a non-drum note
  sound:play-note instrument (60 + pxcor) 128 .2
wait random 2 * (.25)


asked in CSC 150 January201920 by (8 points)

This is super helpful, thank you!

7 Answers

+7 votes

Thank you for sharing your work!

answered by (8 points)
+7 votes

Thank you, this helped a lot!

answered by (8 points)
+6 votes

Very helpful!

answered by (8 points)
+6 votes

Ahh I kept trying to play the drums using the note command and it wasn't working for me. Thank you so much !!

answered by (8 points)
+6 votes

Thanks for this, I had no idea how to use drums this was extremely helpful!!

answered by (8 points)
+5 votes

was very helpful. Thankyou

answered by (8 points)
+3 votes

Thank you so much <3

answered by (8 points)