nqp.world_elements package¶
Submodules¶
nqp.world_elements.actions module¶
nqp.world_elements.camera module¶
- class Camera(size: pygame.math.Vector2)[source]¶
Bases:
object
Basic math for getting view of game world
- zoom¶
positive numbers “zoom out”, negative numbers “zoom in”
World units are equal to pixels at zoom level of 0.0
- __init__(size: pygame.math.Vector2)[source]¶
- centre(pos: pygame.math.Vector2)[source]¶
Immediately centre the camera on a world point
- clamp(rect: pygame.Rect)[source]¶
Move camera so that it is contained in the rect
Has same behaviour as pygame.Rect.clamp
- get_centre() pygame.math.Vector2 [source]¶
Get copy of the position
- get_rect() pygame.Rect [source]¶
Return Pygame Rect representing the visible area of the camera
- get_size() pygame.math.Vector2 [source]¶
Return vector of the size after zoom is applied
- render_offset() pygame.math.Vector2 [source]¶
Return vector for drawing offset
- set_target_position(pos: Optional[pygame.math.Vector2])[source]¶
Move camera to position over time. Pass None to clear.
nqp.world_elements.entity_components module¶
- class AI(behaviour: BasicEntityBehaviour)[source]¶
Bases:
snecs.component.RegisteredComponent
An Entity’s AI. This should handle the outputs of AI decisions and actions.
- __init__(behaviour: BasicEntityBehaviour)[source]¶
- class Aesthetic(animation: nqp.base_classes.animation.Animation)[source]¶
Bases:
snecs.component.RegisteredComponent
An Entity’s visual information
- __init__(animation: nqp.base_classes.animation.Animation)[source]¶
- class Allegiance(team: str, unit: nqp.command.unit.Unit)[source]¶
Bases:
snecs.component.RegisteredComponent
An Entity’s allegiance.
- __init__(team: str, unit: nqp.command.unit.Unit)[source]¶
- class Attributes[source]¶
Bases:
snecs.component.RegisteredComponent
A series of flags defining the attributes of a Unit
- class DamageReceived(amount: int, damage_type: nqp.core.constants.DamageType, penetration: int, is_crit: bool)[source]¶
Bases:
snecs.component.RegisteredComponent
Damage to be applied to the Entity.
- __init__(amount: int, damage_type: nqp.core.constants.DamageType, penetration: int, is_crit: bool)[source]¶
- class HealReceived(amount: int, healing_source: nqp.core.constants.HealingSource)[source]¶
Bases:
snecs.component.RegisteredComponent
Healing to be applied to the Entity.
- __init__(amount: int, healing_source: nqp.core.constants.HealingSource)[source]¶
- add_heal(amount: int, healing_source: nqp.core.constants.HealingSource)[source]¶
- class IsDead[source]¶
Bases:
snecs.component.RegisteredComponent
Flag to indicate if the Entity is dead.
- class IsReadyToAttack[source]¶
Bases:
snecs.component.RegisteredComponent
Flag to indicate if the Entity is ready to attack.
- class Position(pos: pygame.math.Vector2)[source]¶
Bases:
snecs.component.RegisteredComponent
An Entity’s location in the world.
- __init__(pos: pygame.math.Vector2)[source]¶
- classmethod deserialize(pos: pygame.math.Vector2)[source]¶
Deserialize a serialized instance of this component.
Will get the output of serialize as an argument.
Override this in all your Component classes to make use of snecs’ full-World serialization feature.
- class RangedAttack(ammo: int, projectile_sprite: nqp.base_classes.image.Image, projectile_speed: int)[source]¶
Bases:
snecs.component.RegisteredComponent
An Entity’s ability to use projectiles.
- __init__(ammo: int, projectile_sprite: nqp.base_classes.image.Image, projectile_speed: int)[source]¶
- class Stats(parent_unit: nqp.command.unit.Unit)[source]¶
Bases:
snecs.component.RegisteredComponent
An Entity’s stats, such as attack.
- __init__(parent_unit: nqp.command.unit.Unit)[source]¶
- classmethod deserialize(*serialised)[source]¶
Deserialize a serialized instance of this component.
Will get the output of serialize as an argument.
Override this in all your Component classes to make use of snecs’ full-World serialization feature.
- class Tracked[source]¶
Bases:
snecs.component.RegisteredComponent
A component to track an entity’s actions.
nqp.world_elements.hitbox module¶
nqp.world_elements.item module¶
nqp.world_elements.particle module¶
- class Particle(loc: pygame.math.Vector2, vel: pygame.math.Vector2, dur, colour)[source]¶
Bases:
object
- __init__(loc: pygame.math.Vector2, vel: pygame.math.Vector2, dur, colour)[source]¶
nqp.world_elements.particle_manager module¶
- class ParticleManager[source]¶
Bases:
object
Class to manage all particles and their functionality, including creating, drawing and deletion.
- create_blood_spray(pos: pygame.Vector2, blood_colour: Tuple[int, int, int] = Colour.BLOOD_RED)[source]¶
- create_smoke(pos: pygame.math.Vector2)[source]¶
- draw(surface: pygame.Surface, offset=(0, 0))[source]¶
nqp.world_elements.projectile module¶
- class Projectile(game: Game, owner: EntityID, target: EntityID, projectile_data: Dict[str, Union[Image, int]], damage: int, damage_type: DamageType, penetration: int, is_crit: bool)[source]¶
Bases:
object
- __init__(game: Game, owner: EntityID, target: EntityID, projectile_data: Dict[str, Union[Image, int]], damage: int, damage_type: DamageType, penetration: int, is_crit: bool)[source]¶
- draw(surf, offset: pygame.math.Vector2)[source]¶
nqp.world_elements.projectile_manager module¶
nqp.world_elements.stats module¶
- class FloatStat(base_value: float)[source]¶
Bases:
nqp.base_classes.stat.Stat
nqp.world_elements.unit_attribute module¶
- class UnitAttribute(base_value: bool)[source]¶
Bases:
abc.ABC
A container for a Unit’s Attribute
- # TODO - This is currently a copy of Stat and needs to be updated to work for bools only
with False taking precedence over True
- apply_modifier(func: Callable, key: Any)[source]¶
Add a modifier
When value is calculated,
func
will be called with the base value- Parameters
func – Any callable function
key – Unique identifier for adding and removing
- property base_value¶
- has_modifier(key: Any)[source]¶
Check if modifier is applied
- Parameters
key – Unique identifier for adding and removing
- remove_modifier(key: Any)[source]¶
Remove a modifier
- Parameters
key – Unique identifier for adding and removing
- property value¶