globals [ game-over? treasures-collected jones-health whip-cooldown ] breed [snakes snake] breed [archaeologists archaeologist] archaeologists-own [ has-whip? fear-level ] snakes-own [ aggression guarding-treasure? stunned-time ] to setup clear-all set game-over? false set treasures-collected 0 set jones-health 100 set whip-cooldown 0 ; Create temple environment create-temple ; Create treasures create-treasures ; Create Indiana Jones create-archaeologists 1 [ set color brown set shape "person" set size 1.5 setxy random-xcor random-ycor set has-whip? true set fear-level 0 ] ; Create snakes create-snakes 8 [ set color green set shape "turtle" ; We'll use turtle shape for now - you can create custom snake shape set size 1.2 setxy random-xcor random-ycor set aggression random 10 + 5 set guarding-treasure? false set stunned-time 0 ; Some snakes guard treasures if random 100 < 40 [ set guarding-treasure? true let nearest-treasure min-one-of patches with [pcolor = yellow] [distance myself] if nearest-treasure != nobody [ move-to nearest-treasure ] ] ] reset-ticks end to create-temple ; Create temple walls and floors ask patches [ if pxcor = max-pxcor or pxcor = min-pxcor or pycor = max-pycor or pycor = min-pycor [ set pcolor gray + 2 ; Temple walls ] if random 100 < 10 [ set pcolor gray + 1 ; Temple floor stones ] ] ; Create some temple pillars repeat 5 [ ask patch (random-xcor) (random-ycor) [ set pcolor gray ask neighbors [ if random 100 < 50 [ set pcolor gray ] ] ] ] end to create-treasures ; Create treasure locations repeat 6 [ ask one-of patches with [pcolor = black and not any? turtles-here] [ set pcolor yellow set plabel "💎" ] ] end to go if game-over? [ stop ] ; Update whip cooldown if whip-cooldown > 0 [ set whip-cooldown whip-cooldown - 1 ] ; Move Indiana Jones move-jones ; Move snakes ask snakes [ move-snake check-snake-interactions ] ; Check game conditions check-game-status tick end to move-jones ask archaeologists [ ; Jones seeks treasures but avoids snakes let nearest-treasure min-one-of patches with [pcolor = yellow] [distance myself] let nearest-snake min-one-of snakes [distance myself] ; Calculate fear level based on nearby snakes set fear-level count snakes in-radius 3 ; Movement logic ifelse nearest-snake != nobody and distance nearest-snake < 3 [ ; Run away from snakes! let escape-direction towards nearest-snake + 180 set heading escape-direction + random 60 - 30 forward 0.8 ] [ ; Go toward treasure if no immediate danger if nearest-treasure != nobody [ face nearest-treasure set heading heading + random 40 - 20 ; Add some randomness forward 0.5 ] ] ; Collect treasure if standing on it if pcolor = yellow [ set treasures-collected treasures-collected + 1 set pcolor black set plabel "" ] ; Use whip if snakes are close and whip is ready if fear-level > 0 and has-whip? and whip-cooldown = 0 and mouse-down? [ use-whip ] ; Stay within temple bounds if pxcor >= max-pxcor - 1 or pxcor <= min-pxcor + 1 or pycor >= max-pycor - 1 or pycor <= min-pycor + 1 [ set heading heading + 180 forward 1 ] ] end to move-snake ifelse stunned-time > 0 [ ; Snake is stunned, don't move set stunned-time stunned-time - 1 set color gray ] [ set color green ifelse guarding-treasure? [ ; Guarding snakes patrol around treasure let treasure-patch min-one-of patches with [pcolor = yellow] [distance myself] if treasure-patch != nobody [ ifelse distance treasure-patch > 2 [ face treasure-patch forward 0.3 ] [ ; Patrol around treasure set heading heading + random 90 - 45 forward 0.2 ] ] ] [ ; Hunting snakes chase Jones let jones-nearby archaeologists in-radius 5 ifelse any? jones-nearby [ ; Chase Jones! face min-one-of jones-nearby [distance myself] forward 0.4 ] [ ; Random movement set heading heading + random 60 - 30 forward 0.3 ] ] ; Slithering effect - snakes move in slightly curved paths set heading heading + random 20 - 10 ] end to check-snake-interactions ; Check if snake catches Jones let jones-here archaeologists-here if any? jones-here and stunned-time = 0 [ ask jones-here [ set jones-health jones-health - 5 ; Knock Jones back set heading [heading] of myself + 180 forward 2 ] ] end to use-whip ; Indiana Jones uses his whip! set whip-cooldown 20 ; 20 tick cooldown ; Stun nearby snakes ask snakes in-radius 2 [ set stunned-time 30 + random 20 set color gray ] ; Visual effect ask archaeologists [ ask patches in-radius 2 [ if random 100 < 30 [ set pcolor orange ] ] ] ; Reset patch colors after a moment wait 0.1 ask patches with [pcolor = orange] [ set pcolor black ] end to check-game-status ; Check win condition if treasures-collected >= 6 [ set game-over? true user-message "Indiana Jones wins! All treasures collected!" ] ; Check lose condition if jones-health <= 0 [ set game-over? true user-message "Game Over! Indiana Jones was defeated by the snakes!" ] end ; Reporter procedures for monitoring to-report jones-status let status "" ask archaeologists [ set status (word "Health: " jones-health " | Treasures: " treasures-collected " | Fear: " fear-level) ] report status end