Turtle Island
No preview image
Model was written in NetLogo 5.2.0
•
Viewed 181 times
•
Downloaded 13 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Click to Run Model
; SEA = 104 ; LAND = 62 ; LAVA = ORANGE ; ROCKS = GREY ; DESERT = 43 ; UI = BLACK ; UI BORDER = 2 globals [health sticks a1 a2 chosen rocks toolcost gold tool elife dmg range worth1 delay waittime mxcor mycor sec min1 hour sec1 min2] patches-own [pop pop2] turtles-own [worth] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SETUP to setup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAP MAKING ca ask patches [ set pcolor 104 set pop pcolor set pcolor black + 0.01 ] while [count patches with [pop = 62] < 28000] [ ask one-of patches with [pop = 104] [ set pop 62 ask patches in-radius (random 10 + 7) [ set pop 62 ] ] ] ask n-of 60 patches with [pop = 62] [ set pop grey ask patches in-radius 4 with [pop = 62] [ set pop grey ] ] ask n-of 10 patches with [pop = grey] [ ask patches in-radius (random 5 + 8) with [pop != 104 and pop != orange] [ set pop grey ] ] ask n-of 10 patches with [pop = 62] [ set pop orange ask patches in-radius (random 3 + 3) with [pop = 62 or pop = grey] [ set pop orange ] ] ask patches with [pop = orange] [ if count neighbors4 with [pop = 104] > 0 [ set pop grey ] ] ask n-of 10 patches with [pop = 62] [ set pop 43 ask patches in-radius (random 10 + 7) with [pop = 62] [ set pop 43 ] ] ask n-of 50 patches with [count patches in-radius 3 with [pop != grey] = 0] [ set pop yellow ] ask one-of patches with [pop = grey] [ set pop 104 ask neighbors [ set pop yellow ] ] ask n-of 3 patches with [pop = 62] [ ask neighbors [ ask neighbors [ set pop grey ] ] set pop brown ask neighbors [ set pop brown ] ask one-of patches in-radius 2 with [pop = grey] [ set pop brown ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BUTTONS, ETC. ask patches with [pxcor < -131] [ set pcolor black set pop pcolor ] ask patches with [pxcor = -131] [ set pcolor 2 set pop pcolor ] ask patches with [pycor < -45 and pxcor > 126] [ set pcolor 2 set pop pcolor ] ask patches with [pycor < -46 and pxcor > 127] [ set pcolor black set pop pcolor ] ask patches with [pycor = 38 and pxcor <= -131] [ set pcolor 2 set pop pcolor ] ask patches with [pycor = -55 and pxcor <= -131] [ set pcolor 2 set pop pcolor ] ask patches with [pycor = 67] [ set pcolor 2 set pop pcolor ] ask patches with [pxcor <= -133 and pycor <= 36 and pycor >= 30 and pxcor > -150] [ set pcolor white set pop pcolor set pcolor lime ] ask patches with [pxcor <= -133 and pycor <= 28 and pycor >= 22 and pxcor > -150] [ set pcolor white + 0.01 set pop pcolor ] ask patches with [pxcor <= -133 and pycor <= 20 and pycor >= 14 and pxcor > -150] [ set pcolor pink set pop pcolor ] ask patches with [pxcor < -131 and pycor <= 6 and pycor >= 3] [ set pcolor black + 0.015 set pop pcolor ] ask patches with [pxcor < -131 and pycor <= 2 and pycor >= 0] [ set pcolor black + 0.02 set pop pcolor ] ask patches with [pxcor < -131 and pycor <= -1 and pycor >= -3] [ set pcolor black + 0.025 set pop pcolor ] ask patches with [pxcor < -131 and pycor <= -4 and pycor >= -6] [ set pcolor black + 0.03 set pop pcolor ] ask patches with [pxcor < -131 and pycor <= -7 and pycor >= -9] [ set pcolor black + 0.035 set pop pcolor ] ask patches with [pxcor < -131 and pycor <= -10 and pycor >= -12] [ set pcolor black + 0.04 set pop pcolor ] ask patches with [pxcor < -131 and pycor <= -13 and pycor >= -15] [ set pcolor black + 0.045 set pop pcolor ] ask patches with [pxcor < -131 and pycor <= -16 and pycor >= -18] [ set pcolor black + 0.05 set pop pcolor ] ask patches with [pxcor >= 130 and pycor = 60] [ set pcolor 2 set pop pcolor ] ask patches with [pxcor = 130 and pycor >= 60] [ set pcolor 2 set pop pcolor ] ask patches with [pxcor > 130 and pycor > 60] [ set pcolor black set pop pcolor ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TREES ask n-of 200 patches with [pop = 62] [ sprout 1 [ set shape "tree" set color lime set size 3 ht ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PLAYER crt 1 [ set shape "turtle" set color white while [pop = 104 or pop = grey or pop = orange or pop = black or pop = 2] [ setxy random-xcor random-ycor ] set size 5 set heading 0 let name user-input "Name your turtle." set label name set label-color black ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ENEMIES set worth1 2 set elife 5 crt 5 [ set shape "enemy" set size 4.5 setxy random-xcor random-ycor while [pop = 104 or pop = grey or pop = orange or pop = black or pop = 2 or xcor <= -131] [ setxy random-xcor random-ycor ] set heading 0 set label elife set label-color black set worth label ht ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOUSE AIM set elife 8 crt 1 [ set shape "aim" set size 3.5 set color red set heading 0 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOUSE LABELMAKER crt 1 [ set size 0.0000000001 set heading 0 ] ask patches [ set pop2 pop ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBALS set health 10 set a1 "" set a2 "" set toolcost 6 set gold 10 set tool 0 set range 15 set dmg 1 set delay 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TREES IN RADIUS FOR EMERGANCIES ask turtles with [shape = "turtle"] [ ask n-of 5 patches in-radius 7 with [pop != 104 and pop != grey and pxcor > -131 and pop != orange] [ sprout 1 [ set shape "tree" set color lime set size 3 ht ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GO to go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SETUP while [count turtles = 0] [ setup ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DISCOVERING MAP ask turtles with [shape = "turtle"] [ ask patches in-radius 7 [ if pcolor != lime and pcolor != brown [ set pcolor pop ] ] ask turtles in-radius 7 [ st ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOUSE FOLLOWING ask turtles with [shape = "aim"] [ setxy mouse-xcor mouse-ycor ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INFO ask patch -133 44 [ set plabel word "Health- " health set plabel-color green ] ask patch -133 11 [ set plabel "GOLD-" set plabel-color yellow ] ask patch -133 8 [ set plabel gold set plabel-color yellow ] ask patch -133 40 [ set plabel word "Found- " word round ((count patches with [pcolor != black + 0.01 and pop != black and pop != 2] / 37407) * 100) "%" set plabel-color violet ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEATH RED PATCHES if health <= 0 [ ask patches [ set pcolor red set plabel "" ask patch 0 0 [ set plabel "YOU DIED!" set plabel-color black ] ask turtles with [shape = "tree" or shape = "turtle" or shape = "enemy" or shape = "aim" or shape = "default"] [ die ] ] ifelse user-yes-or-no? "Restart?" = true [ setup ] [ ca stop ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TURTLES HIDING ask turtles with [shape != "aim" and shape != "default"] [ ifelse pcolor = black + 0.01 [ ht ] [ st ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DIFFERENT PROCEDURES choosematerial LvlUpTool wiggle shoot enemyspawn enemyattack ExplainGains gametime ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INFO ask patch -134 -61 [ set plabel a1 ] ask patch -134 -65 [ set plabel a2 ] ask patch -134 -57 [ set plabel "UPDATES-" ] ask patch -132 4 [ ifelse tool > 0 [ set plabel "AXE" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ask patch -132 1 [ ifelse tool > 1 [ set plabel "PICKAXE" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ask patch -132 -2 [ ifelse tool > 2 [ set plabel "HARD THROW" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ask patch -132 -5 [ ifelse tool > 3 [ set plabel "DRILL" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ask patch -132 -8 [ ifelse tool > 4 [ set plabel "STEEL" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ask patch -132 -11 [ ifelse tool > 5 [ set plabel "100 mph" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ask patch -132 -14 [ ifelse tool > 6 [ set plabel "DIAMOND" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ask patch -132 -17 [ ifelse tool > 7 [ set plabel "SLEEK SPEAR" set plabel-color blue ] [ set plabel "?" set plabel-color blue ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TIMER ifelse sec < 10 [ set sec1 word "0" sec ] [ set sec1 sec ] ifelse min1 < 10 [ set min2 word "0"min1 ] [ set min2 min1 ] ask patch 149 64 [ set plabel word hour word " : " word min2 word " : " sec1 set plabel-color white ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WEAPON DELAY every 0.1 [ if waittime > 0 [ set waittime waittime - 0.1 ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOUSE LABELMAKER FOLLOWING ask turtles with [shape = "aim"] [ set mxcor xcor set mycor ycor ] ask turtles with [shape = "default"] [ ifelse mxcor + 35 >= 150 [ setxy mxcor mycor ] [ setxy (mxcor + 35) mycor ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UPGRADE BUTTON LABELS ask patch -134 35 [ set plabel "STICKS-" set plabel-color black ] ask patch -134 32 [ set plabel sticks set plabel-color black ] ask patch -134 27 [ set plabel "ROCKS-" set plabel-color black ] ask patch -134 24 [ set plabel rocks set plabel-color black ] ask patch -133 19 [ set plabel "NEW ABILITY" set plabel-color black ] ask patch -134 16 [ set plabel toolcost set plabel-color black ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;FORWARD to fd1 ask turtles with [shape = "turtle"] [ set heading 0 fd 1 if pcolor = grey or pcolor = 104 or pcolor = black or pcolor = 2 or pcolor = yellow [ bk 1 ] if pcolor = orange [ bk 2 set health health - 1 set a2 a1 set a1 "-1 Health" ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RIGHT to rt1 ask turtles with [shape = "turtle"] [ set heading 90 fd 1 if pcolor = grey or pcolor = 104 or pcolor = black or pcolor = 2 or pcolor = yellow [ bk 1 ] if pcolor = orange [ bk 2 set health health - 1 set a2 a1 set a1 "-1 Health" ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;LEFT to lt1 ask turtles with [shape = "turtle"] [ set heading 270 fd 1 if pcolor = grey or pcolor = 104 or pcolor = black or pcolor = 2 or pcolor = yellow [ bk 1 ] if pcolor = orange [ bk 2 set health health - 1 set a2 a1 set a1 "-1 Health" ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BACK to bk1 ask turtles with [shape = "turtle"] [ set heading 180 fd 1 if pcolor = grey or pcolor = 104 or pcolor = black or pcolor = 2 or pcolor = yellow [ bk 1 ] if pcolor = orange [ bk 2 set health health - 1 set a2 a1 set a1 "-1 Health" ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TAKE to take ask turtles with [shape = "turtle"] [ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TREES if any? turtles with [shape = "tree"] in-radius 2 and tool > 0 [ ask one-of turtles with [shape = "tree"] in-radius 2 [ set sticks sticks + 1 set a2 a1 set a1 "+1 Stick" die ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ROCKS fd 1 ifelse pcolor = grey and tool > 1 [ set pcolor 62 set rocks rocks + 1 set a2 a1 set a1 "+1 Rock" ask patch-here [ ifelse pop2 != grey [ set pcolor pop2 set pop pop2 ] [ set pop 62 ] ] bk 1 ] [ bk 1 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PLACED STICKS fd 1 ifelse pcolor = brown and tool > 0 [ ifelse pop != brown [ set pcolor pop set sticks sticks + 1 set a2 a1 set a1 "+1 Stick" bk 1 ] [ set pop 62 set pcolor pop set sticks sticks + 1 set a2 a1 set a1 "+1 Stick" bk 1 ] ] [ bk 1 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GOLD fd 1 ifelse pcolor = yellow and tool > 3 [ set pop 62 let z random 2 + 1 set gold gold + z set a2 a1 set a1 word "+" word z " Gold" bk 1 ] [ bk 1 ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;USE MATERIAL to use ask turtles with [shape = "turtle"] [ fd 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;STICKS if chosen = 0 [ ifelse pcolor != grey and pcolor != orange and pcolor != black and sticks > 0 and pcolor != 2 and pcolor != brown [ set pcolor brown bk 1 set sticks sticks - 1 ] [ bk 1 ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ROCKS if chosen = 1 [ ifelse pcolor != grey and pcolor != orange and pcolor != black and rocks > 0 and pcolor != 2 [ set pcolor grey ask patch-here [ set pop grey ] bk 1 set rocks rocks - 1 ] [ bk 1 ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CHOOSING MATERIAL to choosematerial ask patch mouse-xcor mouse-ycor [ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;STICKS if pcolor = white and mouse-down? [ ask patches with [pcolor = lime] [ set pcolor pop ] ask patches with [pcolor = white] [ set pcolor lime ] set chosen 0 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ROCKS if pcolor = white + 0.01 and mouse-down? [ ask patches with [pcolor = lime] [ set pcolor pop ] ask patches with [pcolor = white + 0.01] [ set pcolor lime ] set chosen 1 ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAVING GAME to save if user-yes-or-no? "Do you want to save your game?" = true [ export-world user-new-file user-message "Game saved." ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IMPORTING SAVE to open-save if user-yes-or-no? "Do you want to import a save file?" = true [ import-world user-file user-message "Save imported. If you have not done so, press PLAY to begin." ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;LEVEL UP TOOL to LvlUpTool ask patch mouse-xcor mouse-ycor [ if pcolor = pink and mouse-down? [ ifelse toolcost <= gold [ set gold gold - toolcost set toolcost ((toolcost * 2) + 5) set tool tool + 1 set a2 a1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AXE if tool = 1 [ set a1 "+ Axe" ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PICKAXE if tool = 2 [ set a1 "+ Pickaxe" ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;HARD THROW if tool = 3 [ set a1 "+ Hard Throw" set range 20 set delay 0.8 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DRILL if tool = 4 [ set a1 "+ Drill" ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;STEEL if tool = 5 [ set a1 "+ Steel" set dmg 2 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100 MPH if tool = 6 [ set a1 "+ 100 mph" set delay 0.6 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DIAMOND if tool = 7 [ set a1 "+ Diamond" set dmg 3 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SLEEK SPEAR if tool = 8 [ set a1 "+ Sleek Spear" set range 35 ] wait 0.5 ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IF NOT ENOUGH MONEY [ user-message "You need more gold!" ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ENEMY WIGGLE to wiggle every 0.09 [ ask turtles with [shape = "enemy"] [ if any? turtles in-radius 15 with [shape = "turtle"] [ face one-of turtles in-radius 15 with [shape = "turtle"] ] fd 0.4 ifelse pop2 = grey or pop2 = 104 or pop2 = black or pop2 = 2 or pop2 = orange or pop2 = yellow [ bk 1 rt 90 ] [ rt random 91 - 45 ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SHOOT to shoot ask patch mouse-xcor mouse-ycor [ if mouse-down? and pcolor != black + 0.01 and pcolor != black and pcolor != 2 and pcolor != lime and pcolor != white and pcolor != white + 0.01 and pcolor != pink and waittime <= 0 [ ask turtles with [shape = "turtle"] [ hatch 1 [ set shape "spear" set size 3 facexy mouse-xcor mouse-ycor set label "" set waittime delay repeat range [ wait 0.01 fd 0.5 if pcolor = grey or pcolor = black + 0.01 or pcolor = black or pcolor = 2 [ die ] if any? turtles in-radius 2 with [shape = "enemy"] [ ask turtles in-radius 2 with [shape = "enemy"] [ set label label - dmg ] die ] ] die ] ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SPAWNING ENEMIES to enemyspawn ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IF NOT ENOUGH ENEMIES, CREATE MORE if count turtles with [shape = "enemy"] <= 5 [ crt 1 [ set shape "enemy" set size 4.5 setxy random-xcor random-ycor ifelse count patches with [pcolor = black + 0.01 and pop2 != 104] > 0 [ while [pop = 104 or pop = grey or pop = orange or pop = black or pop = 2 or pcolor != black + 0.01 or xcor <= -131] [ setxy random-xcor random-ycor ] ] [ while [pop = 104 or pop = grey or pop = orange or pop = black or pop = 2 or xcor <= -131] [ setxy random-xcor random-ycor ] ] set heading 0 set label elife set label-color black set worth label ht set elife elife + 3 ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ENEMY DEATHS AND GAINS ask turtles with [shape = "enemy"] [ if label <= 0 [ set gold gold + round (worth / 3) set a2 a1 set a1 word "+" word round (worth / 3) " Gold" let y random 2 if y > 0 [ set health health + y set a2 a1 set a1 word "+" word y " Health" ] die ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ENEMY ATTACKING YOU to enemyattack ask turtles with [shape = "enemy"] [ if any? turtles in-radius 2 with [shape = "turtle"] [ set health health - round (label / 2) set a2 a1 set a1 word "-" word round (label / 2) " Health" bk 2 ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EXPLAIN GAINS to explainGains ask patch mouse-xcor mouse-ycor [ ifelse pcolor = 0.015 or pcolor = 0.02 or pcolor = 0.025 or pcolor = 0.03 or pcolor = 0.035 or pcolor = 0.04 or pcolor = 0.045 or pcolor = 0.05 [ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AXE if pcolor = 0.015 [ ask turtles with [shape = "default"] [ ifelse tool > 0 [ set label "Ability to mine wood and trees." ] [ set label "? " ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PICKAXE if pcolor = 0.02 [ ask turtles with [shape = "default"] [ ifelse tool > 1 [ set label "Ability to mine stone. " ] [ set label "? " ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;HARD THROWS if pcolor = 0.025 [ ask turtles with [shape = "default"] [ ifelse tool > 2 [ set label "Less delay and better range" ] [ set label "? " ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DRILL if pcolor = 0.03 [ ask turtles with [shape = "default"] [ ifelse tool > 3 [ set label "Ability to mine gold blocks " ] [ set label "? " ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;STEEL if pcolor = 0.035 [ ask turtles with [shape = "default"] [ ifelse tool > 4 [ set label "Steel spearhead, more damage" ] [ set label "? " ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100 MPH if pcolor = 0.04 [ ask turtles with [shape = "default"] [ ifelse tool > 5 [ set label "Less delay " ] [ set label "? " ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DIAMOND if pcolor = 0.045 [ ask turtles with [shape = "default"] [ ifelse tool > 6 [ set label "Diamond-tipped spear, more damage" ] [ set label "? " ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SLEEK SPEAR if pcolor = 0.05 [ ask turtles with [shape = "default"] [ ifelse tool > 7 [ set label "Less air resistance = more range" ] [ set label "? " ] ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BLANK LABEL [ ask turtles with [shape = "default"] [ set label "" ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TIMER to gametime every 1 [ set sec sec + 1 if sec = 60 [ set min1 min1 + 1 set sec 0 if min1 = 60 [ set hour hour + 1 set min1 0 ] ] ] end
There is only one version of this model, created over 8 years ago by Ethan Carson.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
Ron Schildge
Great Game!
Wow, there are so many things I could say about this game. You really demonstrate the potential of NetLogo for game development. And your game is fun to play too!
Posted over 8 years ago