Skip to content

Handy Dandy Guide to Actors

sleepinghungry edited this page Jan 17, 2017 · 10 revisions

Step-By-Step Guide

To create a new actor or animal:

(Animals can roam around to different locations, actors have to stay in a single location)

  1. Use the Actor or Animal command:
          Actor_or_Animal()
    Example for Actors:
          Actor()
    Example for Animals:
          Animal()

  2. Insert the name of your new character:
          Actor_or_Animal("name of character")
    Examples:
          Actor("angry elf")
          Animal("sad polar bear")

  3. Store your new character in a variable:
          actor_or_animal_variable = Actor_or_Animal("name of character")
    Examples:
          angry_elf = Actor("angry elf")
          sad_polar_bear = Animal("sad polar bear")

To set your new character's starting location

  1. Type in the actor or animal variable:
          actor__or_animal_variable
    Examples:
          angry_elf
          sad_polar_bear

  2. Attach the set_location command to it:
          actor_or_animal_variable**.set_location()**
    Examples:
          angry_elf.set_location()
          sad_polar_bear.set_location()

  3. Add the location_variable of the starting location:
          actor_or_animal_variable.set_location(location_variable)
    Examples:
          angry_elf.set_location(playground)
          sad_polar_bear.set_location(upstairs)

To add an in-game command for an actor or animal

  1. Choose what actor variable you want to attach a special command to:
          actor_or_animal_variable
    Examples:
          angry_elf
          sad_polar_bear

  2. Attach the add_phrase command to it:
          actor_or_animal_variable**.add_phrase()**
    Examples:
          angry_elf.add_phrase()
          sad_polar_bear.add_phrase()

  3. Add the in-game command as the first piece of info needed by the add_phrase command:
          actor_or_animal_variable.add_phrase("in-game command")
    Examples:
          angry_elf.add_phrase("chat")
          sad_polar_bear.add_phrase("chat")

  4. Add the Say command (Yes, we're putting a command INSIDE another command!):       actor__or_animal_variable.add_phrase("in-game command", Say())
    Examples:
          angry_elf.add_phrase("chat", Say())
          sad_polar_bear.add_phrase("chat", Say())

  5. Add what the game says when the in-game command is used:
          actor_or_animal_variable.add_phrase("in-game command", Say("What the game will say."))
    Examples:
          angry_elf.add_phrase("chat", Say("The angry elf glares at you as you attempt to start a conversation."))
          sad_polar_bear.add_phrase("chat", Say("The polar bear groans sadly."))

To add the character to the game

  1. Use the game variable:
          game_variable
    Example:
          game

  2. Add the add_actor command to it:
          game_variable**.add_actor()**
    Example:
          game.add_actor()

  3. Add the actor or animal variable:
          game_variable.add_actor(actor_or_location_variable)
    Examples:
          game.add_actor(angry_elf)
          game.add_actor(sad_polar_bear)

To set where your animal is allowed to roam (animal only command):

  1. Type in the animal's variable:
          animal_variable
    Example:
          sad_polar_bear

  2. Attach the set_allowed_locations command to it:
          animal_variable**.set_allowed_locations()**
    Example:
          sad_polar_bear.set_allowed_locations()

  3. Add a list of location variables to the set_allowed_locations command. A list is made by using square brackets []. Each item in the list is separated by commas [list_item1, list_item2, list_item3]:
          animal_variable.set_allowed_locations([location_variable1, location_variable2, location_variable3])
    Example:
          sad_polar_bear.set_allowed_locations([upstairs, vestibule,front])

To add a list of responses to a single in-game command (works for items, actors, and animals)

  1. Choose what item, actor, or animal variable you want to attach a special command to:
          item_actor_or_animal_variable
    Examples:
          red_ball
          angry_elf
          sad_polar_bear

  2. Attach the add_phrase command to it:
          item_actor_or_animal_variable**.add_phrase()**
    Examples:
          red_ball.add_phrase()
          angry_elf.add_phrase()
          sad_polar_bear.add_phrase()

  3. Add the in-game command as the first piece of info needed by the add_phrase command:
          item_actor_or_animal_variable.add_phrase("in-game command")
    Examples:
          red_ball.add_phrase("bounce ball")
          angry_elf.add_phrase("chat")
          sad_polar_bear.add_phrase("pet polar bear")

  4. Add the Say command (Yes, we're putting a command INSIDE another command!):
          item_actor_or_animal_variable.add_phrase("in-game command", Say())
    Examples:
          red_ball.add_phrase("bounce ball", Say())
          angry_elf.add_phrase("chat", Say())
          sad_polar_bear.add_phrase("pet polar bear", Say())

  5. Add a list of things the game will say when the in-game command is used. This list will go in the Say command. Remember, a list is made by using square brackets []. Each item in the list is separated by commas [list_item1, list_item2, list_item3]:
          item_actor_or_animal_variable.add_phrase("in-game command", Say(["A lot of text.","Some more text.","One other piece of text."]))
    Examples:
          red_ball.add_phrase("bounce ball", Say(["This is fun!","The ball bounces happily."]))
          angry_elf.add_phrase("chat", Say(["The elf glares back at you.","The elf mutters to himself.","The elf turns his back on you."]))
          sad_polar_bear.add_phrase("pet sad polar bear", Say(["The polar bear seems happier","The polar bear licks your face.","The polar bear closes its eyes, dreaming of playing in the snow."]))

BWX Game Engine pages

Python Pages

Step By Step Guides

Building Conditionals

Lectures

Explaining Conditionals

Assignments

I Am Thinking of a Number...

Clone this wiki locally