Nothing but Net Videogame

No preview image

1 collaborator

Default-person Robert Dennis (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 223 times • Downloaded 30 times • Run 0 times
Download the 'Nothing but Net Videogame' modelDownload this modelEmbed this model

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

globals [ robotX robotY robotH capacityB capacityR launcherH cstep time timing? score running? loadA loadD elevatingL? elevatingH? elevation]
breed [tiles tile]
breed [tape tapesing]
breed [balls ball]
breed [robots robot]
breed [rollers roller]
breed [launchers launcher]

to startup
  setup
end 

to setup
  ca
  reset-ticks
  import-drawing "Gael (1).png"
  set elevation "Normal"
  set elevatingL? false
  set elevatingH? false
  set timing? true
  set running? true
  set loadA 4
  set loadD 24
  set cstep 0
  set robotX 0
  set robotY 1
  ask patches [
    set pcolor grey
  ]
  create-tiles 1 [
    set shape "square"
    set color blue
    set size 10
    setxy 0 1
  ]
  create-tiles 1 [
    set shape "square"
    set color blue
    set size 10
    setxy 1 0
  ]
  create-tiles 1 [
    set shape "square"
    set color red
    set size 10
    setxy 4 0
  ]
  create-tiles 1 [
    set shape "square"
    set color red
    set size 10
    setxy 5 1
  ]
  create-tiles 1 [
    set shape "tri"
    set color blue
    set size 10
    setxy 5 5
    set heading 180
  ]
  create-tiles 1 [
    set shape "tri"
    set color red
    set size 10
    setxy 0 5
    set heading 90
  ]
  create-tape 1 [
    set shape "circle"
    set size 0.1
    set color white
    setxy 5.55 1.45
    set heading towardsxy 1.5 5.5
    while[xcor < 1.44]
    [
      fd 0.01
      hatch 1
    ]
    set heading 0
    while[ycor < 1.44]
    [
      fd 0.01
      hatch 1
    ]
    set heading 270
    while[xcor > -0.45]
    [
      fd 0.01
      hatch 1
    ]
  ]
  create-tape 1 [
    set shape "circle"
    set size 0.1
    set color white
    setxy 5.45 1.45
    set heading towardsxy 3.5 5.5
    while[xcor > 3.55]
    [
      fd 0.01
      hatch 1
    ]
    set heading 0
    while[ycor < 1.44]
    [
      fd 0.01
      hatch 1
    ]
    set heading 90
    while[xcor < 5.45]
    [
      fd 0.01
      hatch 1
    ]
  ]
  create-tape 1 [
    set shape "circle"
    set size 0.1
    set color white
    setxy 1.5 1.5
    hatch 1
    set heading towardsxy 4 4
    while[xcor < 5]
    [
      fd 0.01
      hatch 1
    ]
  ]
  create-tape 1 [
    set shape "circle"
    set size 0.1
    set color white
    setxy 3.5 1.5
    hatch 1
    set heading towardsxy 1 4
    while[xcor > 0]
    [
      fd 0.01
      hatch 1
    ]
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 3.5 1.5
  ]
    create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 1.5 1.5
    ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 3.5 3.5
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 1.5 3.5
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 2.5 0.5
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 2.5 4.5
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 2.5 5.65
    set heading 180
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 2.5 5.35
    set heading 0
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 5.35 2.5
    set heading 90
  ]
  create-balls 1 [
    set shape "nbnpyramid"
    set size 1.5
    setxy 5.65 2.5
    set heading 270
  ]
  create-robots 1 [
    set shape "robot"
    set size 1.40625
    setxy 0 1
    set color 2
    set heading 0
  ]
  create-rollers 1 [
    set shape "rollers"
    set size 1
    setxy 0 1.25
    set color 0
    set heading 0
  ]
  create-launchers 1 [
    set shape "launcher"
    set size 1
    setxy 0 1
    set color 0
    set heading 0
  ]
end 

to up
  if running? and not elevatingH? and not elevatingL?
  [
  ask robots [
    set robotX (xcor + (sin(heading) * 0.05 * speed)) 
    set robotY (ycor + (cos(heading) * 0.05 * speed))    
  ]
  ]
end 

to down
  if running? and not elevatingH? and not elevatingL?
  [
  ask robots [
    set robotX (xcor - (sin(heading) * 0.05 * speed)) 
    set robotY (ycor - (cos(heading) * 0.05 * speed))
  ]
  ]
end 

to rturn
  if running? and not elevatingH? and not elevatingL?
  [
  ask robots [
    set robotH (heading + 5 * speed)
  ]
  ]
end 

to lturn
  if running? and not elevatingH? and not elevatingL?
  [
  ask robots [
    set robotH (heading - 5 * speed)
  ]
  ]
end 

to strafeR
  if running? and not elevatingH? and not elevatingL?
  [
  ask robots [
    set robotX (xcor + (sin(heading + 90) * 0.05 * speed)) 
    set robotY (ycor + (cos(heading + 90) * 0.05 * speed))
  ]
  ]
end 

to strafeL
  if running? and not elevatingH? and not elevatingL?
  [
  ask robots [
    set robotX (xcor - (sin(heading + 90) * 0.05 * speed)) 
    set robotY (ycor - (cos(heading + 90) * 0.05 * speed))
  ]
  ]
end 

to shoot
  if running?
  [
  ifelse(capacityB > 0)
  [
    set capacityB capacityB - 1
    create-balls 1 [
      set shape "nbnball"
      set color orange
      set size 1.5
      setxy robotX robotY
      set heading launcherH          
    ]
  ]
  [
    if(capacityR > 0)
    [
      set capacityR capacityR - 1
      create-balls 1 [
        set shape "nbnball"
        set color green
        set size 1.5
        setxy robotX robotY
        set heading launcherH
      ]
    ]
  ]
  ]
end 

to go
  if running?
  [
    ask robots [
      if(robotx < -0.12)
      [
        set robotx -0.12
      ]
      if(roboty < -0.12)
      [
        set roboty -0.12
      ]
      if(robotx > 5.12)
      [
        set robotx 5.12
      ]
      if(roboty > 5.12)
      [
        set roboty 5.12
      ]
      setxy robotX robotY
      set heading robotH
    ]
    ask rollers [
      setxy (robotx + 0.25 * sin(robotH)) (roboty + 0.25 * cos(robotH))
      set heading robotH
    ]
    ask balls with [shape = "nbnpyramid"][
      if(distance one-of rollers < 0.25 and capacityB + capacityR = 0)
      [
        set capacityB capacityB + 1
        set capacityR capacityR + 3
        die
      ]
    ]
    ask launchers [
      setxy robotx roboty
      set launcherH atan (5 - robotX) (5 - robotY)
      set heading launcherH
    ]
    ask balls with [shape = "nbnball"] [
      ifelse(distancexy 5 5 > 0.25)
      [
        fd 0.1
      ]
      [
        ifelse(color = orange)
        [
          set score score + 10
        ]
        [
          set score score + 5
        ]
        die
      ]
    ]
    commentary
    if timing?
    [
      set time timer
    ]
    ifelse elevatingL?
    [
      set elevation "Low"
    ]
    [
      ifelse elevatingH?
      [
        set elevation "High"
      ]
      [
        set elevation "Normal"
      ]
    ]
    wait 0.01
  ]
end 

to commentary
  if(cstep = 0)
  [
    setup
    output-print "Autonomous begins in 3"
    wait 0.5
    output-print "2"
    wait 0.5
    output-print "1"
    wait 0.5
    output-print "Go!"
    set cstep 1
    reset-timer
  ]
  if(timer >= 10 and cstep = 1)
  [
    output-print "5 seconds left!"
    set cstep 2
  ]
  if(timer >= 15 and cstep = 2)
  [
    set score score + 10
    output-print (word "Time's up! You scored " score )
    set LoadD LoadD + LoadA
    set LoadA 0
    set cstep 3
    set timing? false
    set time 15
    set running? false
    wait 1
    output-print "Driver Control begins in 3"
    wait 0.5
    output-print "2"
    wait 0.5
    output-print "1"
    wait 0.5
    output-print "Go!"
    set timing? true
    set running? true
  ]
  if(timer >= 90 and cstep = 3)
  [
    output-print "30 seconds left!"
    set cstep 4
  ]
  if(timer >= 120 and cstep = 4)
  [
    if elevatingL?
    [
      set score score + 25
    ]
    if elevatingH?
    [
      set score score + 50
    ]
    output-print (word "Time's up! You scored " score )
    set cstep 3
    set timing? false
    set time 120
    set running? false
  ]
end 

to load
  if not elevatingH? and not elevatingL? [
    ask robots [
      ifelse(timer < 15)
      [
        if(CapacityR + CapacityB < 4 and LoadA > 0 and distancexy 0 1 <= 1)
        [
          set CapacityR CapacityR + 1
          set LoadA LoadA - 1
        ]
      ]
      [
        if(CapacityR + CapacityB < 4 and LoadD > 0 and distancexy 0 1 <= 1)
        [
          set CapacityR CapacityR + 1
          set LoadD LoadD - 1
        ]
      ]
    ]
  ]
end 

to elevateL
  ask robots [
    if robotX >= -0.12 and robotX <= 1.2 and robotY >= -0.12 and robotY <= 1.2 and running? and time >= 90[
      set elevatingL? not elevatingL?
      set elevatingH? false
    ]
  ]
end 

to elevateH
  ask robots [
    if robotX >= -0.12 and robotX <= 1.2 and robotY >= -0.12 and robotY <= 1.2 and running? and time >= 90[
      set elevatingH? not elevatingH?
      set elevatingL? false
    ]
  ]
end 

There is only one version of this model, created over 9 years ago by Robert Dennis.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.