blockslider


Information

Created with NetLogo version NetLogo 4.0.4
Running with NetLogoLite.jar version 404.


WHAT IS IT?


-------
A demo.

Procedures

NetLogo Version: NetLogo 4.0.4

globals [ click? click-patch ]

to startup setup end

to setup
    ca
   ask patches
   [ sprout 1
     [ set color 5 + 10 * random 13 
       set shape "square"
     ]
   ]
   ask one-of turtles [ die ]
   set click? false
   display
end   

to go
   if not ( click? = true ) and mouse-down?
   [ set click? true
     set click-patch patch mouse-xcor mouse-ycor
   ]
   if ( click? = true ) and not mouse-down?
   [ set click? false
     if click-patch = patch mouse-xcor mouse-ycor
       [if any? turtles-on click-patch
       [ let t one-of turtles-on click-patch
         let p [ neighbors4 with [ not any? turtles-here ] ] of t
         if any? p
         [ set p one-of p
           let h [ towards p ] of t
           let d [ distance p ] of t
           
           let xx round sin h * d * .04
           let yy round cos h * d * .04
           repeat 25
           [ ask t [ setxy (xcor + xx) (ycor + yy) display ]
             wait .01
           ]
           ask t [ setxy pxcor pycor ]
         ]
       ]
     ]
   ]
end
     
   
      

                    


Download Link

View or download the complete model file (to download: right-click, save-link-as):
-- Download blockslider --