Cowboy_vs._Ninja

Created by Scott Finlay

You need to download Java software in order to view this Alice world. Please visit this page: http://www.alice.org/applet/requirements/

Created with Alice, the easy-to-learn programming system. Provided free as a public service by Carnegie Mellon University


If you don't see 3d graphics on this page, click for help.

Cowboy_vs._Ninja's Code

Created by:

world

Events

When the world starts
Do:
world.my first method NinjaDead = true killedninja = true


Methods

  world.my first method ( [T/F] NinjaDead, [T/F] killedninja)
    NinjaDead1 = true , doors = true
       Loop 1 time time
       Do together
       square set opacity to 0 (0%)
  revolver set vehicle to cowboy.upperBody.jacket.rightArm.forearm.hand
  revolver move to cowboy.upperBody.jacket.rightArm.forearm.hand
  revolver turn forward 0.12 revolutions
  revolver move left 0.12 meters
  revolver turn left 0.12 revolutions
  Do together
       revolver move forward 0.12 meters
  cowboy move forward 1 meter duration = 0.5 seconds
  Do together
       saloon.leftDoor turn right 0.25 revolutions duration = 0.25 seconds
  saloon.rightDoor turn left 0.25 revolutions duration = 0.25 seconds
  doors set value to true
  If ( ( cowboy distance below evilNinja ) >= 2 )
       evilNinja turn left 0.5 revolutions duration = 0.25 seconds
  Do together
       evilNinja move up 1 meter duration = 0.25 seconds
  evilNinja move backward 0.5 meters duration = 0.25 seconds
  Do together
       evilNinja move backward 0.5 meters duration = 0.5 seconds
  evilNinja move down 5.3 meters duration = 0.5 seconds
  evilNinja say Halt! I am ninja! Give me your money! duration = 2 seconds
  cowboy.upperBody.jacket.rightArm.forearm turn backward 0.12 revolutions duration = 0.5 seconds
  cowboy say How about I give you my BULLETS!? duration = 2 seconds
  revolver say *BANG* duration = 2 seconds
  Do together
       evilNinja say Aha! I am invisible! duration = 2 seconds
  evilNinja set opacity to 0 (0%) duration = 0.5 seconds
  NinjaDead set value to true
  killedninja set value to false
  Wait 1 second
  Else
  Do Nothing
  While ( NinjaDead == true )
       Do together
       sheriff turn to face cowboy style = abruptly
  sheriff move forward 4 meters
  sheriff move to cowboy
  While ( sheriff is within 2 meters of cowboy )
       Do together
       sheriff say Hey! Did you kill that ninja?
  sheriff move amount = 0.25 meters away from target = cowboy
  cowboy turn to face sheriff
  cowboy.upperBody.jacket.rightArm.forearm turn forward 0.12 revolutions duration = 0.5 seconds
  If ( killedninja == true )
       cowboy say Uhhh...no, of course not! duration = 2 seconds
  sheriff say Really? Okay, then. duration = 2 seconds
  Do together
       sheriff turn left 0.5 revolutions duration = 0.25 seconds style = abruptly
  sheriff move forward 20 meters
  Wait 1 second
  cowboy think Sucker... duration = 2 seconds
  cowboy turn to face saloon.inside
  Do together
       cowboy move forward 5 meters
  saloon.leftDoor turn left 0.25 revolutions duration = 1 second
  saloon.rightDoor turn right 0.25 revolutions duration = 1 second
  NinjaDead set value to false
  square set opacity to 1 (100%) duration = 2 seconds
  Else
    cowboy say You bet I did! duration = 2 seconds
  sheriff say What!? duration = 2 seconds
  Do together
       cowboy say Ha, ha! duration = 1 second
  cowboy turn to face saloon.inside duration = 0.25 seconds style = abruptly
  Wait 0.25 seconds
  Do together
       cowboy move forward 5 meters
  saloon.leftDoor turn left 0.25 revolutions duration = 2 seconds
  saloon.rightDoor turn right 0.25 revolutions duration = 2 seconds
  Do together
       square set opacity to 1 (100%)
  NinjaDead set value to false
  sheriff turn to face cowboy style = abruptly
  sheriff move forward 4 meters
  sheriff say Hey, come back here!
  saloon.rightDoor turn left 0.25 revolutions duration = 2 seconds
  saloon.rightDoor turn right 0.25 revolutions duration = 1 second