Package pajammin :: Package entity :: Module projectile :: Class Projectile
[show private | hide private]
[frames | no frames]

Type Projectile

object --+    
         |    
    Entity --+
             |
            Projectile

Known Subclasses:
Fireball, Spark, Star, Web

An object that follows a fixed parabolic trajectory until it hits another entity; if the entity it hits is an agent, then it affects that agent (typically by hurting it).
Method Summary
  __init__(self, attacker, x, y, xvel, yvel)
  handle_collision(self, obstacle, side)
Called when one of the entity's bodies collides with another body.
  hit(self, agent)
Apply this projectile's effect to the given agent.
  miss(self, obstacle)
    Inherited from Entity
  __repr__(self)
  add_body(self, body)
  add_sprite(self, sprite)
  after(self, duration, callback, *params, **kwparams)
After the given duration has elapsed, call the given callback function.
  handle_lose_support(self, old_support)
Called when one of the entity's bodies becomes unsupported.
  handle_movement(self, dx, dy)
Called when one of the entity's bodies moves.
  icon(cls)
Return an image that can be used as an icon for this entity class. (Class method)
  remove_body(self, body)
  remove_sprite(self, sprite)
  update(self, duration)
Perform any necessary updates to this entity.
  use(self)
Define this method for entities that the avatar can 'use'.
  _check_after_callbacks(self, duration)
    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)...

Property Summary
    Inherited from Entity
  bodies
  sprites

Instance Variable Summary
    Inherited from Entity
bool alive: A flag indicating whether the entity is alive or not.
  bodies = pajammin.entity.entity.Entity.bodies
NoneType level: A pointer to the level that contains this entity (if any).
  sprites = pajammin.entity.entity.Entity.sprites
NoneType update_delay: The amount of time that has elapsed since the last time update was called for this entity.

Class Variable Summary
NoneType damage: The amount of damage that is inflicted by this class of projectile.
NoneType damage_type: The type of damage inflicted by this class of projectile, such as PHYSICAL or FIRE.
NoneType hit_sprite = None                                                                  
NoneType miss_sprite = None                                                                  
tuple size = (2, 2)
NoneType sprite_category = None                                                                  
int yaccel = 600                                                                   
    Inherited from Entity
bool autouse = False
bool is_usable = False
int update_interval: The interval at which entities in a given class should have its update function called.
tuple _after_callbacks = ()
tuple _bodies = ()
tuple _sprites = ()

Instance Method Details

__init__(self, attacker, x, y, xvel, yvel)
(Constructor)

Overrides:
__builtin__.object.__init__

handle_collision(self, obstacle, side)

Called when one of the entity's bodies collides with another body. By default, this does nothing.
Overrides:
pajammin.entity.entity.Entity.handle_collision (inherited documentation)

hit(self, agent)

Apply this projectile's effect to the given agent. By default, this just hurts the agent with this projectile's damage; but subclasses can override this method to perform additional actions.

miss(self, obstacle)


Class Variable Details

damage

The amount of damage that is inflicted by this class of projectile. This can either be a single number, or a tuple (mindamage, maxdamage), in which case the actual damage for each projectile will be randomly selected from that range.
Type:
NoneType
Value:
None                                                                  

damage_type

The type of damage inflicted by this class of projectile, such as PHYSICAL or FIRE. If the projectile class has multiple damage types, then simply and the flags for each damage type together.
Type:
NoneType
Value:
None                                                                  

hit_sprite

Type:
NoneType
Value:
None                                                                  

miss_sprite

Type:
NoneType
Value:
None                                                                  

size

Type:
tuple
Value:
(2, 2)                                                                 

sprite_category

Type:
NoneType
Value:
None                                                                  

yaccel

Type:
int
Value:
600