turtles-own radius? ;; it can only be defined at the beginning of the program and it applies to all turtles. it defines a variable of the turtles... in this case radius
to setup ;; starts procedure setup
ca ;; clear all crt 1 ;; creates one turtle
ask turtle 0 [ ;; it asks the turtle 0 to do the following
set size 2 ;; sets turtle size to 2 set color blue ;; sets color to blue set shape "turtle" ;; sets shape to turtle -you can change it to other figures... very cool. set heading 0 ;; set heading north set radius 0 ;; sets radius of turtle to 0 pendown ;; turtle draws a line as it goes.
]
end ;; end procedure setup
to step ;; starts procedure step
ask turtles [ ask the turtles to do the following
set heading (heading + 10) ;; sets the heading the given heading plus 10 degrees set radius (radius + .005) ;; sets radius to current radius + .005 ? fd radius ;; asks radius to move forward if not can-move? radiusdie? ;; if the turtle can't move forward plus ten degrees given the radius then kill the little turtle
]
end ;; end of procedure step
to go ;; start procedure go
step ;; do procedure step
end ;; end of procedure go
Monster Sound as file not at applet here.
extensions sound? ;; you need to add this in order to get sound at the very beg. of your program.
breed monsters monster?;; since i am working with different figures i created this monster breed also as a global.
breed stars star?;; creates a breed stars.
to setup;;; procedure setup
ca ;; clear-all create-turtles 20 ;; creates 20 turtles set-default-shape turtles "yellowcircle";; i choose the shape of the turtles to be a "yellow circle" a figure i also created in the library create-monsters 2;; creates two monsters from by global category.
set-default-shape monsters "monster";; it sets my default shape to be "monsters" which is one shape i created in my local library.
create-stars 13;; creates 13 stars -a shape from netlogo's library. set-default-shape stars "star";; you have to re-state that your default shape is stars in order to call it from the library.
end ;;; end of procedure setup
to step ;;; procedure step
ask turtles[ ;; starts a command or procedure
set size 1 ;; which is to set size to 1 (not too big so that they look better) pd;; i ask my turtles to leave a track pen down fd 5;; i ask my turtles to go 5 steps forward ] sound:play-note "KALIMBA" 60 20 0.1 ;; since i've already established the global sound i can call any sound from the library. this case kalimba. the first number 60 stands for the note, 20 is for ? and 0.1 for duration.
ask turtles[
back 1;; gives turtles the procedure go back 1 step. ] sound:play-note "TINKLE BELL" 72 64 0.2 ;; same explanation from proceedure sound:play note above
ask turtles[
fd 3;; same than above, forward 3 steps. ] sound:play-note "METAL" 63 64 0.2 ;; see above.
;;;;;;;;;;;;;;; from here down, i call random sounds at random times, i use different sounds such as steel drums, sci-fi, agogo, etc and at ;;;;;;;;;;different intervals of time that create a sense of confusion. the turtles (circles, monsters and stars move back and forth calling this ;;;;;;sounds...
ask turtles[
back 5 ] sound:play-note "STEEL DRUMS" 72 64 0.1
ask turtles[
fd 2 ] sound:play-note "SCI-FI" 63 64 0.1
ask monsters[
set heading 0 set size 7 fd 1 ] sound:play-note "AGOGO" 60 64 0.5
ask monsters[
back 14 ] sound:play-note "RAIN" 72 64 0.5
ask monsters[
fd 10 ] sound:play-note "RAIN" 63 64 0.5
ask monsters[
back 20 ] sound:play-note "RAIN" 72 64 0.5
ask turtles[
fd 10 ] sound:play-note "RAIN" 63 64 0.5
ask monsters[
back 10 ] sound:play-note "RAIN" 72 64 0.5
ask monsters[
fd 5 ] sound:play-note "RAIN" 63 64 0.5
ask monsters[
back 40 ] sound:play-note "RAIN" 72 64 0.5
ask turtles[
fd 20 ] sound:play-note "RAIN" 63 64 0.5
sound:play-note "KALIMBA" 60 20 0.1
ask turtles[
back 10 ] sound:play-note "TINKLE BELL" 72 64 0.2
ask turtles[
fd 3 ] sound:play-note "METAL" 63 64 0.2
ask turtles[
back 15 ] sound:play-note "STEEL DRUMS" 72 64 0.1
ask turtles[
fd 2 ]
foreach 60 72 64 71 67 69 71 72? ;; here i call one sound for each note that is written in the [? creating a little melody.
sound:start-note "PICCOLO" ? 65 wait 0.2 sound:stop-note "PICCOLO" ?
] wait 1;; i delay all sounds for 1 second sound:play-note "TINKLE BELL" 72 64 0.2;; i call this tinkle bell high pitch ask turtlesdie?;; and then i ask my turtles to disappear.
sound:play-note "TINKLE BELL" 72 64 0.2 ask monstersdie?;; and i ask my monsters to disappear too. its pretty cool!
end;;; end of procedure step
to go ;;; procedure go
step ;;; asks turtle to do step
end ;;; end of procedure go
SoundTrumpet here.
even though you can't see it, cause netlogo hasn't figure that out yet! you can copy the procedures and open on your own net logo ;).