Package pajammin :: Package ai :: Package script :: Module walker :: Class WalkAround
[show private | hide private]
[frames | no frames]

Type WalkAround

object --+    
         |    
      Task --+
             |
            WalkAround


Move a walker around randomly. In particular, this task randomly selects between jumping (p=10%), stopping (p=20%), walking left (p=35%), and walking right (p=35%); and then does that action for a random duration ranging from 0.5 secs to 2.0 secs.
Method Summary
  __init__(self, agent, duration, jump_prob, stop_prob)
  act(self, level)
Attempt to accomplish this task, by examining and/or modifying the level; and should return a TaskResult object, indicating what action should be taken next.
    Inherited from Task
  __repr__(self)
  initialize(self, level)
This method is called when a script starts using this task.
  interrupt(self, level, condition, task_stack)
Attempt to accomplish this task, given that an interrupt condition occured.
  recover(self, level, failed_subtask, remaining_subtasks, failure_info)
Attempt to accomplish this task, given that a subtask failed.
  register(cls, *typesignature)
Register this task class as a task that can be used in the task list of a script. (Class method)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Instance Variable Summary
    Inherited from Task
NoneType fail_task: A variable used to hold the task that should be notified if this task fails.
NoneType next_task: A variable used to hold the task that should be performed after this task.
NoneType timeout: If set to a value other than None, then this task will automatically fail if it has not finished before this amount of time (in msec) has elapsed.

Class Variable Summary
list defaults = [None, (500, 2000), 0.10000000000000001, 0.20...
NoneType signature: The type signature of this task.
    Inherited from Task
tuple interrupts = ()
NoneType require = None                                                                  
dict task_classes = {'WaitForAvatar': <class 'pajammin.ai.scr...

Instance Method Details

__init__(self, agent, duration=(500, 2000), jump_prob=0.10000000000000001, stop_prob=0.20000000000000001)
(Constructor)

Overrides:
pajammin.ai.script.script.Task.__init__

act(self, level)

Attempt to accomplish this task, by examining and/or modifying the level; and should return a TaskResult object, indicating what action should be taken next. See the class descriptions for the subclasses of TaskResult for information about the actions performed by each task.

Each time act() is called, it should only do a very small amount of work -- this will ensure that the game runs more smoothly.
Overrides:
pajammin.ai.script.script.Task.act (inherited documentation)

Class Variable Details

defaults

Type:
list
Value:
[None, (500, 2000), 0.10000000000000001, 0.20000000000000001]          

signature

The type signature of this task. This class variable is set by the class method register(), which registers this task for use with the level editor.
Type:
NoneType
Value:
[('agent', <class 'pajammin.entity.agent.walker.Walker'>),
 ('duration', 'int'),
 ('jump_prob', 'float'),
 ('stop_prob', 'float')]