Package pajammin :: Package entity :: Package agent :: Module agent :: Class ProjectileAttack
[show private | hide private]
[frames | no frames]

Type ProjectileAttack

object --+    
         |    
AttackType --+
             |
            ProjectileAttack

Known Subclasses:
SprayAttack

An attack type that launches a Projectile.
Method Summary
  __init__(self, projectile_class, speed, angle, offset, animation, delay, cooldown, mana_cost)
  fire(self, attacker, angle, speed)
Perform the actual attack action.
  projectile_initial_pos(self, attacker)
    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
  __repr__(x)
Return repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Instance Variable Summary
  angle: The default angle at which to fire the projectile.
  offset: A tuple (i,j), describing the initial position for the projectile.
  projectile_class: The subclass of Projectile that should be used to create the projectile launched by this attack.
  speed: The default speed with which to fire the projectile.
    Inherited from AttackType
  animation: The base name of the animation that the agent's sprite should display when using this attack.
  cooldown: The minimum amount of time that can elapse between using this attack and starting the next attack.
  delay: The amount of time that the agent should wait after it starts playing the animation before performing the attack action with fire.

Method Details

__init__(self, projectile_class, speed=200, angle=45, offset=(0, 0), animation=None, delay=0, cooldown=0, mana_cost=0)
(Constructor)

Parameters:
speed - The initial speed of the projectile.
Overrides:
pajammin.entity.agent.agent.AttackType.__init__

fire(self, attacker, angle=None, speed=None)

Perform the actual attack action. This method does not perform any animations or start the agent's cooldown timer.
Parameters:
angle - The angle at which to fire the projectile. If not specified, then the default angle will be used.
speed - The speed with which to fire the projectile. If not specified, then the default speed will be used.
Overrides:
pajammin.entity.agent.agent.AttackType.fire

projectile_initial_pos(self, attacker)


Instance Variable Details

angle

The default angle at which to fire the projectile. This can be overridden when making an actual attack.

offset

A tuple (i,j), describing the initial position for the projectile. This offset describes the relationship between the middle of the agent and the nearer mid-side of the projectile. The i coordinate corresponds to distance in the direction that the agent is facing; and the j coordinates correspond to distance perpendicular to the direction that the agent is facing.

projectile_class

The subclass of Projectile that should be used to create the projectile launched by this attack.

speed

The default speed with which to fire the projectile. This can be overridden when making an actual attack.