Logo Bolo: a re-envisioning of the classic tank game by Stuart Cheshire in NetLogo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- ;; lobo: Logo Bolo
- ;; (c) Ben Kurtovic, 2011-2012
-
- globals [
- explosions-table
- ]
-
- breed [explosions explosion]
-
- explosions-own [
- midlife
- size-increment
- time-to-live
- ]
-
- ;; ==========
- ;; Procedures
- ;; ==========
-
- to make-explosions-table
- ; Fun with particle effects!
- set explosions-table table:make
- table:put explosions-table "small" [["explosion-small" 0.65 10 0.5]]
- table:put explosions-table "medium" [["explosion-med" 1.25 10 0.5]]
- table:put explosions-table "large" [["explosion-large" 2.5 15 0.5] ["explosion-med" 1.25 10 1]
- ["explosion-med" 1.1 8 1 ] ["explosion-small" 0.65 7 2]
- ["explosion-small" 0.65 5 3 ]]
- table:put explosions-table "huge" [["explosion-large" 3 20 0.5] ["explosion-med" 1.25 15 1]
- ["explosion-med" 1.25 15 1 ] ["explosion-med" 1.25 10 1]
- ["explosion-med" 1.25 10 1 ] ["explosion-small" 0.65 10 2]
- ["explosion-small" 0.65 10 2 ] ["explosion-small" 0.65 8 2]
- ["explosion-small" 0.65 7 2 ] ["explosion-small" 0.65 5 3]
- ["explosion-small" 0.65 5 3 ]]
- end
-
- to explode [name]
- let data table:get explosions-table name
- foreach data [
- create-explosion ?
- ]
- end
-
- to create-explosion [info]
- let sprite (item 0 info)
- let maxsize (item 1 info)
- let lifespan (item 2 info)
- let deviation (item 3 info)
- hatch-explosions 1 [
- set label ""
- set shape sprite
- set size maxsize / 2
- set midlife lifespan / 2
- set size-increment (maxsize / lifespan) * 2
- set time-to-live lifespan
- set heading random 360
- fd (random 100) / (100 / deviation)
- ]
- end
-
- to keep-exploding
- if time-to-live = 0 [
- die
- ]
- set time-to-live time-to-live - 1
- set midlife midlife - 1
- ifelse midlife > 0 [
- set size size + size-increment
- ] [
- set size size - size-increment
- ]
- end
|