to setup ; executed when we press the SETUP button ca ; clear all patches and turtles crt 1 ; create one turtle ask turtles [ set shape "man-standing" ; set its shape to the "man-standing" shape set heading 90 ; set its heading to 90 degrees, i.e. to the right ] end to go ; continuously executed since GO is a forever button if (velocity = 0) [stand] ; if velocity is 0, then execute STAND if (velocity = 1) [walk] ; if velocity is 1, then execute WALK if (velocity = 2) [run] ; if velocity is 2, then execute RUN end to stand ; WHEN THE MAN STANDS: ask turtles[ set shape "man-standing" ; if velocity=0, the man is standing wait 0.5 ] end to walk ; WHEN THE MAN WALKS: ask turtles [ ifelse (shape = "walking-right") ; if his shape is "walking-right" [set shape "walking-left"] ; then set it to "walking-left" [set shape "walking-right"] ; else set it to "walking-right" wait 0.5 fd 1 ; move forward ] end to run ; WHEN THE MAN RUNS: ask turtles[ ifelse (shape = "running-right") ; if his shape is "running-right" [set shape "running-left"] ; then set it to "running-left" [set shape "running-right"] ; else set it to "running-right" wait 0.2 fd 1 ; move forward ] end ; This model was created as part of the project: CONNECTED MATHEMATICS: ; MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL ; MODELS (OBPML) ; The project gratefully acknowledges the support of the National Science ; Foundation (Applications of Advanced Technologies Program) -- grant numbers ; RED #9552950 and REC #9632612. ; ; Copyright 1999 by Uri Wilensky. All rights reserved. ; ; Permission to use, copy, or modify this software and its documentation for ; educational and research purposes only and without fee is hereby granted, ; provided that this copyright notice and the original authors' names appear ; on all copies and supporting documentation. For any other uses of this ; software, in original or modified form, including but not limited to ; distribution in whole or in part, specific prior permission must be ; obtained from Uri Wilensky. These programs shall not be used, rewritten, or ; adapted as the basis of a commercial software or hardware product without ; first obtaining appropriate licenses from Uri Wilensky. We make no ; representations about the suitability of this software for any purpose. It ; is provided "as is" without express or implied warranty. @#$#@#$#@ CC-WINDOW 12 134 309 309 Command Center BUTTON 76 34 131 64 Setup setup NIL 1 T OBSERVER BUTTON 147 34 202 64 Go go T 1 T OBSERVER SLIDER 82 82 174 106 velocity velocity 0 2 1 1 1 GRAPHICS-WINDOW 321 10 653 342 4 4 36.888888888888886 1 @#$#@#$#@ WHAT IS IT? ----------- This code example shows how to use shapes to create animations. In this model, the moving turtle alternates between two shapes to give the impression of motion. To make your own shapes, press the SHAPES button on the right-hand side of the toolbar.You can create your own design or select from the existing shapes. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 walking-right false 0 Circle -16776961 true false 113 23 76 Rectangle -16776961 true false 136 91 164 209 Polygon -16776961 true false 136 209 122 238 122 269 151 269 151 255 136 255 137 240 150 209 179 239 179 254 210 254 210 240 196 240 163 209 136 209 136 209 Polygon -16776961 true false 135 105 105 105 91 150 105 150 121 120 180 120 195 135 225 105 211 105 196 120 181 105 running-right false 0 Circle -16776961 true false 160 40 72 Polygon -16776961 true false 181 105 150 120 136 165 136 195 165 195 165 165 181 119 195 105 Polygon -16776961 true false 137 195 121 225 121 239 121 255 150 255 150 240 134 240 135 224 150 195 137 195 Polygon -16776961 true false 165 194 181 225 181 240 210 240 210 226 195 226 166 179 Line -16776961 false 166 180 190 190 Line -16776961 false 164 180 192 192 Line -16776961 false 166 180 190 190 Line -16776961 false 164 180 191 191 Line -16776961 false 166 181 193 193 Line -16776961 false 165 191 181 181 Polygon -16776961 true false 172 135 195 165 225 150 215 141 195 151 176 124 Polygon -16776961 true false 151 121 128 110 106 134 116 139 129 124 148 131 151 121 man-standing false 0 Circle -16776961 true false 112 23 75 Rectangle -16776961 true false 136 91 164 209 Polygon -16776961 true false 136 107 106 107 91 149 105 149 120 121 136 121 181 121 195 150 211 150 195 106 Polygon -16776961 true false 136 209 106 225 106 255 90 255 90 269 121 269 121 240 150 225 180 240 180 269 211 269 211 256 196 256 196 225 165 210 walking-left false 0 Circle -16776961 true false 113 23 76 Rectangle -16776961 true false 136 91 164 209 Polygon -16776961 true false 137 209 121 240 121 269 150 270 150 256 133 255 151 210 165 255 165 271 194 271 194 257 179 256 162 208 running-left false 0 Circle -16776961 true false 113 23 76 Rectangle -16776961 true false 136 91 164 209 Polygon -16776961 true false 137 209 121 240 121 269 150 270 150 256 133 255 151 210 165 255 165 271 194 271 194 257 179 256 162 208 @#$#@#$#@ NetLogo 1.0 Beta 5 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@