myModel

myModel preview image

1 collaborator

Default-person Yaen Torres (Author)

Tags

game 

Tagged by Yaen Torres about 6 years ago

netlogo 

Tagged by Yaen Torres about 6 years ago

Model group 360 High School | Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.4 • Viewed 371 times • Downloaded 39 times • Run 0 times
Download the 'myModel' 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 [ points fake-ticks ]


breed [ characters character ]
breed [ hostiles hostile ]

to setup
  clear-all
  clear-all

  setup-patches

  setup-characters

  setup-hostiles

  reset-ticks
end 

to setup-patches

  ask patches [ set pcolor lime ]
end 

to setup-characters

  create-characters 1

  ask characters [ setxy random-xcor random-ycor set color gray set size 3 set shape "airplane" ]
end 

to setup-hostiles
  create-hostiles hostile-number
  ask hostiles [ setxy random-xcor random-ycor set color orange set size 2.0 set shape "eyeball" ]
end 

to go
  if fake-ticks >= 100 [
    set fake-ticks fake-ticks - 100
    ask patches [
    	set pcolor lime
    ]
  ]

  move-hostiles
  if count hostiles = 0 [
    stop
    user-message "All hostiles have been eliminated"
  ]

  if count characters = 0 [
    stop
    user-message "You have been eliminated"
  ]
  tick
	set fake-ticks fake-ticks + 1
end 

to leftl
  ask characters [

    left 10

  ]
end 

to rightl

  ask characters [

    right 10

  ]
end 

to move
  ask characters [

    forward 1
    check-if-lost

  ]
  create-trap
end 

to backl
  ask characters [

    forward -1
    check-if-lost

  ]
  create-trap
end 

to move-hostiles
  ask hostiles [
    right random 360
    forward 1
    check-if-hit
    create-hostile-trap
  ]
end 

to create-trap
  ask characters [
    set pcolor red
  ]
end 

to create-hostile-trap
  ask hostiles [
    set pcolor blue
  ]
end 

to check-if-hit
  ask hostiles [
    if pcolor = red [
      set points points + 5
      die
    ]
  ]
end 

to check-if-lost
  ask characters [
    if pcolor = blue [
      die
      stop
    ]
  ]
end 

There are 6 versions of this model.

Uploaded by When Description Download
Yaen Torres about 6 years ago Updated Download this version
Yaen Torres about 6 years ago Updated Download this version
Yaen Torres about 6 years ago Updated Download this version
Yaen Torres about 6 years ago Updated Download this version
Yaen Torres about 6 years ago Hello World Download this version
Yaen Torres about 6 years ago Initial upload Download this version

Attached files

File Type Description Last updated
myModel.png preview Preview for 'myModel' about 6 years ago, by Yaen Torres Download

This model does not have any ancestors.

This model does not have any descendants.