Shape Animation Example
Model was written in NetLogo 5.0.4
•
Viewed 310 times
•
Downloaded 39 times
•
Run 1 time
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
breed [ flowers flower ] breed [ people person ] ;; putting people last ensures people appear ;; in front of flowers in the view people-own [frame] ;; ranges from 1 to 9 flowers-own [age] ;; ranges from 1 to 16 ;; ;; SETUP PROCEDURES ;; to setup ;; executed when we press the SETUP button clear-all ;; clear all patches and turtles create-people 1 [ set heading 90 ;; i.e. to the right set frame 1 set shape "person-1" ] reset-ticks end ;; ;; GO PROCEDURES ;; to go animate tick end to animate move-person ask flowers [ age-flower ] if random 100 < 20 [ make-flower ] end to move-person ask people [ set shape (word "person-" frame) forward 1 / 20 ;; The shapes editor has a grid divided into 20 squares, which when ;; drawing made for useful points to reference the leg and shoe, to ;; make it look like the foot would be moving one square backward ;; when in contact with the ground (relative to the person), but ;; with a relative velocity of 0, when moving forward 1/20th of ;; a patch each frame set frame frame + 1 if frame > 9 [ set frame 1 ] ;; go back to beginning of cycle of animation frames ] end to age-flower ;; flower procedure set age (age + 1) ;; age is used to keep track of how old the flower is ;; each older plant is a little bit taller with a little bit ;; larger leaves and flower. if (age >= 16) [ set age 16 ] ;; we only have 16 frames of animation, so stop age at 16 set shape (word "flower-" age) end to make-flower ;; if every patch has a flower on it, then kill all of them off ;; and start over if all? patches [any? flowers-here] [ ask flowers [ die ] ] ;; now that we're sure we have room, actually make a new flower ask one-of patches with [not any? flowers-here] [ sprout 1 [ set breed flowers set shape "flower-1" set age 0 set color one-of [magenta sky yellow] ] ] end ; Public Domain: ; To the extent possible under law, Uri Wilensky has waived all ; copyright and related or neighboring rights to this model.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Shape Animation Example.png | preview | Preview for 'Shape Animation Example' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.