Ballistica Logo

bascenev1lib.actor package

Submodules

bascenev1lib.actor.background module

Defines Actor(s).

class bascenev1lib.actor.background.Background(fade_time: float = 0.5, start_faded: bool = False, show_logo: bool = False)[source]

Bases: Actor

Simple Fading Background Actor.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

bascenev1lib.actor.bomb module

Various classes for bombs, mines, tnt, etc.

class bascenev1lib.actor.bomb.ArmMessage[source]

Bases: object

Tell an object to become armed.

class bascenev1lib.actor.bomb.Blast(*, position: Sequence[float] = (0.0, 1.0, 0.0), velocity: Sequence[float] = (0.0, 0.0, 0.0), blast_radius: float = 2.0, blast_type: str = 'normal', source_player: bs.Player | None = None, hit_type: str = 'explosion', hit_subtype: str = 'normal')[source]

Bases: Actor

An explosion, as generated by a bomb or some other object.

category: Gameplay Classes

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

class bascenev1lib.actor.bomb.Bomb(*, position: Sequence[float] = (0.0, 1.0, 0.0), velocity: Sequence[float] = (0.0, 0.0, 0.0), bomb_type: str = 'normal', blast_radius: float = 2.0, bomb_scale: float = 1.0, source_player: bs.Player | None = None, owner: bs.Node | None = None)[source]

Bases: Actor

A standard bomb and its variants such as land-mines and tnt-boxes.

category: Gameplay Classes

add_explode_callback(call: Callable[[Bomb, Blast], Any]) None[source]

Add a call to be run when the bomb has exploded.

The bomb and the new blast object are passed as arguments.

arm() None[source]

Arm the bomb (for land-mines and impact-bombs).

These types of bombs will not explode until they have been armed.

explode() None[source]

Blows up the bomb if it has not yet done so.

get_source_player(playertype: type[PlayerT]) PlayerT | None[source]

Return the source-player if one exists and is the provided type.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

on_expire() None[source]

Called for remaining `bascenev1.Actor`s when their activity dies.

Actors can use this opportunity to clear callbacks or other references which have the potential of keeping the bascenev1.Activity alive inadvertently (Activities can not exit cleanly while any Python references to them remain.)

Once an actor is expired (see bascenev1.Actor.is_expired()) it should no longer perform any game-affecting operations (creating, modifying, or deleting nodes, media, timers, etc.) Attempts to do so will likely result in errors.

class bascenev1lib.actor.bomb.BombFactory[source]

Bases: object

Wraps up media and other resources used by bs.Bombs.

Category: Gameplay Classes

A single instance of this is shared between all bombs and can be retrieved via bascenev1lib.actor.bomb.get_factory().

activate_sound: bs.Sound

A bs.Sound for an activating impact bomb.

blast_material: bs.Material

A bs.Material applied to bomb blast geometry which triggers impact events with what it touches.

bomb_material: bs.Material

A bs.Material applied to all bombs.

bomb_mesh: bs.Mesh

The bs.Mesh of a standard or ice bomb.

debris_fall_sound: bs.Sound

The bs.Sound for random falling debris after an explosion.

dink_sounds: Sequence[bs.Sound]

A tuple of bs.Sound-s for when bombs hit the ground.

explode_sounds: Sequence[bs.Sound]

A tuple of bs.Sound-s for explosions.

freeze_sound: bs.Sound

A bs.Sound of an ice bomb freezing something.

fuse_sound: bs.Sound

A bs.Sound of a burning fuse.

classmethod get() BombFactory[source]

Get/create a shared bascenev1lib.actor.bomb.BombFactory object.

hiss_sound: bs.Sound

The bs.Sound for the hiss sound an ice bomb makes.

ice_tex: bs.Texture

The bs.Texture for ice bombs.

impact_blast_material: bs.Material

A bs.Material applied to activated impact-bombs that causes them to explode on impact.

impact_bomb_mesh: bs.Mesh

The bs.Mesh of an impact-bomb.

impact_lit_tex: bs.Texture

The bs.Texture for impact bombs with lights lit.

impact_tex: bs.Texture

The bs.Texture for impact bombs.

land_mine_blast_material: bs.Material

A bs.Material applied to activated land-mines that causes them to explode on impact.

land_mine_lit_tex: bs.Texture

The bs.Texture for land-mines with the light lit.

land_mine_mesh: bs.Mesh

The bs.Mesh of a land-mine.

land_mine_no_explode_material: bs.Material

A bs.Material that keeps land-mines from blowing up. Applied to land-mines when they are created to allow land-mines to touch without exploding.

land_mine_tex: bs.Texture

The bs.Texture for land-mines.

normal_sound_material: bs.Material

A bs.Material that generates standard bomb noises on impacts, etc.

random_explode_sound() Sound[source]

Return a random explosion bs.Sound from the factory.

regular_tex: bs.Texture

The bs.Texture for regular bombs.

roll_sound: bs.Sound

bs.Sound for a rolling bomb.

sticky_bomb_mesh: bs.Mesh

The bs.Mesh of a sticky-bomb.

sticky_impact_sound: bs.Sound

The bs.Sound for a squish made by a sticky bomb hitting something.

sticky_material: bs.Material

A bs.Material that makes ‘splat’ sounds and makes collisions softer.

sticky_tex: bs.Texture

The bs.Texture for sticky bombs.

tnt_mesh: bs.Mesh

The bs.Mesh of a tnt box.

tnt_tex: bs.Texture

The bs.Texture for tnt boxes.

warn_sound: bs.Sound

A bs.Sound for an impact bomb about to explode due to time-out.

wood_debris_fall_sound: bs.Sound

A bs.Sound for random wood debris falling after an explosion.

class bascenev1lib.actor.bomb.ExplodeHitMessage[source]

Bases: object

Tell an object it was hit by an explosion.

class bascenev1lib.actor.bomb.ExplodeMessage[source]

Bases: object

Tells an object to explode.

class bascenev1lib.actor.bomb.ImpactMessage[source]

Bases: object

Tell an object it touched something.

class bascenev1lib.actor.bomb.SplatMessage[source]

Bases: object

Tells an object to make a splat noise.

class bascenev1lib.actor.bomb.TNTSpawner(position: Sequence[float], respawn_time: float = 20.0)[source]

Bases: object

Regenerates TNT at a given point in space every now and then.

category: Gameplay Classes

class bascenev1lib.actor.bomb.WarnMessage[source]

Bases: object

Tell an object to issue a warning sound.

bascenev1lib.actor.controlsguide module

Defines Actors related to controls guides.

class bascenev1lib.actor.controlsguide.ControlsGuide(*, position: tuple[float, float] = (390.0, 120.0), scale: float = 1.0, delay: float = 0.0, lifespan: float | None = None, bright: bool = False)[source]

Bases: Actor

A screen overlay of game controls.

category: Gameplay Classes

Shows button mappings based on what controllers are connected. Handy to show at the start of a series or whenever there might be newbies watching.

exists() bool[source]

Returns whether the Actor is still present in a meaningful way.

Note that a dying character should still return True here as long as their corpse is visible; this is about presence, not being ‘alive’ (see bascenev1.Actor.is_alive() for that).

If this returns False, it is assumed the Actor can be completely deleted without affecting the game; this call is often used when pruning lists of Actors, such as with bascenev1.Actor.autoretain()

The default implementation of this method always return True.

Note that the boolean operator for the Actor class calls this method, so a simple “if myactor” test will conveniently do the right thing even if myactor is set to None.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

bascenev1lib.actor.flag module

Implements a flag used for marking bases, capture-the-flag games, etc.

class bascenev1lib.actor.flag.Flag(*, position: Sequence[float] = (0.0, 1.0, 0.0), color: Sequence[float] = (1.0, 1.0, 1.0), materials: Sequence[bs.Material] | None = None, touchable: bool = True, dropped_timeout: int | None = None)[source]

Bases: Actor

A flag; used in games such as capture-the-flag or king-of-the-hill.

Category: Gameplay Classes

Can be stationary or carry-able by players.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

static project_stand(pos: Sequence[float]) None[source]

Project a flag-stand onto the ground at the given position.

Useful for games such as capture-the-flag to show where a movable flag originated from.

set_score_text(text: str) None[source]

Show a message over the flag; handy for scores.

class bascenev1lib.actor.flag.FlagDiedMessage(flag: Flag)[source]

Bases: object

A message saying a Flag has died.

Category: Message Classes

flag: Flag

The Flag that died.

class bascenev1lib.actor.flag.FlagDroppedMessage(flag: Flag, node: Node)[source]

Bases: object

A message saying a Flag has been dropped.

Category: Message Classes

flag: Flag

The Flag that was dropped.

node: Node

The bs.Node that was holding it.

class bascenev1lib.actor.flag.FlagFactory[source]

Bases: object

Wraps up media and other resources used by `Flag`s.

Category: Gameplay Classes

A single instance of this is shared between all flags and can be retrieved via FlagFactory.get().

flag_texture: Texture

The bs.Texture for flags.

flagmaterial: Material

The bs.Material applied to all `Flag`s.

classmethod get() FlagFactory[source]

Get/create a shared FlagFactory instance.

impact_sound: Sound

The bs.Sound used when a Flag hits the ground.

no_hit_material: Material

A bs.Material that prevents contact with most objects; applied to ‘non-touchable’ flags.

skid_sound: Sound

The bs.Sound used when a Flag skids along the ground.

class bascenev1lib.actor.flag.FlagPickedUpMessage(flag: Flag, node: Node)[source]

Bases: object

A message saying a Flag has been picked up.

Category: Message Classes

flag: Flag

The Flag that has been picked up.

node: Node

The bs.Node doing the picking up.

bascenev1lib.actor.image module

Defines Actor(s).

class bascenev1lib.actor.image.Image(texture: bs.Texture | dict[str, Any], *, position: tuple[float, float] = (0, 0), transition: Transition | None = None, transition_delay: float = 0.0, attach: Attach = Attach.CENTER, color: Sequence[float] = (1.0, 1.0, 1.0, 1.0), scale: tuple[float, float] = (100.0, 100.0), transition_out_delay: float | None = None, mesh_opaque: bs.Mesh | None = None, mesh_transparent: bs.Mesh | None = None, vr_depth: float = 0.0, host_only: bool = False, front: bool = False)[source]

Bases: Actor

Just a wrapped up image node with a few tricks up its sleeve.

class Attach(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Attach types we support.

BOTTOM_CENTER = 'bottomCenter'
CENTER = 'center'
TOP_CENTER = 'topCenter'
TOP_LEFT = 'topLeft'
class Transition(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Transition types we support.

FADE_IN = 'fade_in'
IN_BOTTOM = 'in_bottom'
IN_BOTTOM_SLOW = 'in_bottom_slow'
IN_LEFT = 'in_left'
IN_RIGHT = 'in_right'
IN_TOP_SLOW = 'in_top_slow'
handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

bascenev1lib.actor.onscreencountdown module

Defines Actor Type(s).

class bascenev1lib.actor.onscreencountdown.OnScreenCountdown(duration: int, endcall: Callable[[], Any] | None = None)[source]

Bases: Actor

A Handy On-Screen Timer.

category: Gameplay Classes

Useful for time-based games that count down to zero.

on_expire() None[source]

Called for remaining `bascenev1.Actor`s when their activity dies.

Actors can use this opportunity to clear callbacks or other references which have the potential of keeping the bascenev1.Activity alive inadvertently (Activities can not exit cleanly while any Python references to them remain.)

Once an actor is expired (see bascenev1.Actor.is_expired()) it should no longer perform any game-affecting operations (creating, modifying, or deleting nodes, media, timers, etc.) Attempts to do so will likely result in errors.

start() None[source]

Start the timer.

bascenev1lib.actor.onscreentimer module

Defines Actor(s).

class bascenev1lib.actor.onscreentimer.OnScreenTimer[source]

Bases: Actor

A handy on-screen timer.

category: Gameplay Classes

Useful for time-based games where time increases.

getstarttime() float[source]

Return the scene-time when start() was called.

Time will be returned in seconds if timeformat is SECONDS or milliseconds if it is MILLISECONDS.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

has_started() bool[source]

Return whether this timer has started yet.

start() None[source]

Start the timer.

property starttime: float

Shortcut for start time in seconds.

stop(endtime: int | float | None = None) None[source]

End the timer.

If ‘endtime’ is not None, it is used when calculating the final display time; otherwise the current time is used.

bascenev1lib.actor.playerspaz module

Functionality related to player-controlled Spazzes.

class bascenev1lib.actor.playerspaz.PlayerSpaz(player: bs.Player, *, color: Sequence[float] = (1.0, 1.0, 1.0), highlight: Sequence[float] = (0.5, 0.5, 0.5), character: str = 'Spaz', powerups_expire: bool = True)[source]

Bases: Spaz

A Spaz subclass meant to be controlled by a bascenev1.Player.

Category: Gameplay Classes

When a PlayerSpaz dies, it delivers a bascenev1.PlayerDiedMessage to the current bascenev1.Activity. (unless the death was the result of the player leaving the game, in which case no message is sent)

When a PlayerSpaz is hurt, it delivers a PlayerSpazHurtMessage to the current bascenev1.Activity.

connect_controls_to_player(*, enable_jump: bool = True, enable_punch: bool = True, enable_pickup: bool = True, enable_bomb: bool = True, enable_run: bool = True, enable_fly: bool = True) None[source]

Wire this spaz up to the provided bascenev1.Player.

Full control of the character is given by default but can be selectively limited by passing False to specific arguments.

disconnect_controls_from_player() None[source]

Completely sever any previously connected bascenev1.Player from control of this spaz.

getplayer(playertype: type[PlayerT], doraise: Literal[False] = False) PlayerT | None[source]
getplayer(playertype: type[PlayerT], doraise: Literal[True]) PlayerT

Get the bascenev1.Player associated with this Spaz.

By default this will return None if the Player no longer exists. If you are logically certain that the Player still exists, pass doraise=False to get a non-optional return type.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

class bascenev1lib.actor.playerspaz.PlayerSpazHurtMessage(spaz: PlayerSpaz)[source]

Bases: object

A message saying a PlayerSpaz was hurt.

Category: Message Classes

spaz: PlayerSpaz

The PlayerSpaz that was hurt

bascenev1lib.actor.popuptext module

Defines Actor(s).

class bascenev1lib.actor.popuptext.PopupText(text: str | bs.Lstr, *, position: Sequence[float] = (0.0, 0.0, 0.0), color: Sequence[float] = (1.0, 1.0, 1.0, 1.0), random_offset: float = 0.5, offset: Sequence[float] = (0.0, 0.0, 0.0), scale: float = 1.0)[source]

Bases: Actor

Text that pops up above a position to denote something special.

category: Gameplay Classes

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

bascenev1lib.actor.powerupbox module

Defines Actor(s).

class bascenev1lib.actor.powerupbox.PowerupBox(position: Sequence[float] = (0.0, 1.0, 0.0), poweruptype: str = 'triple_bombs', expire: bool = True)[source]

Bases: Actor

A box that grants a powerup.

category: Gameplay Classes

This will deliver a bs.PowerupMessage to anything that touches it which has the bs.PowerupBoxFactory.powerup_accept_material applied.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

node: Node

The ‘prop’ bs.Node representing this box.

poweruptype: str

The string powerup type. This can be ‘triple_bombs’, ‘punch’, ‘ice_bombs’, ‘impact_bombs’, ‘land_mines’, ‘sticky_bombs’, ‘shield’, ‘health’, or ‘curse’.

class bascenev1lib.actor.powerupbox.PowerupBoxFactory[source]

Bases: object

A collection of media and other resources used by bs.Powerups.

Category: Gameplay Classes

A single instance of this is shared between all powerups and can be retrieved via bs.Powerup.get_factory().

classmethod get() PowerupBoxFactory[source]

Return a shared bs.PowerupBoxFactory object, creating if needed.

get_random_powerup_type(forcetype: str | None = None, excludetypes: list[str] | None = None) str[source]

Returns a random powerup type (string).

See bs.Powerup.poweruptype for available type values.

There are certain non-random aspects to this; a ‘curse’ powerup, for instance, is always followed by a ‘health’ powerup (to keep things interesting). Passing ‘forcetype’ forces a given returned type while still properly interacting with the non-random aspects of the system (ie: forcing a ‘curse’ powerup will result in the next powerup being health).

health_powerup_sound: Sound

bs.Sound played when a health powerup is accepted.

mesh: Mesh

The bs.Mesh of the powerup box.

mesh_simple: Mesh

A simpler bs.Mesh of the powerup box, for use in shadows, etc.

powerdown_sound: Sound

bs.Sound that can be used when powerups wear off.

powerup_accept_material: Material

Powerups will send a bs.PowerupMessage to anything they touch that has this bs.Material applied.

powerup_material: Material

bs.Material applied to powerup boxes.

powerup_sound: Sound

bs.Sound played when a powerup is accepted.

tex_bomb: Texture

Triple-bomb powerup bs.Texture.

tex_curse: Texture

Curse powerup bs.Texture.

tex_health: Texture

Health powerup bs.Texture.

tex_ice_bombs: Texture

Ice bomb powerup bs.Texture.

tex_impact_bombs: Texture

Impact-bomb powerup bs.Texture.

tex_land_mines: Texture

Land-mine powerup bs.Texture.

tex_punch: Texture

Punch powerup bs.Texture.

tex_shield: Texture

Shield powerup bs.Texture.

tex_sticky_bombs: Texture

Sticky bomb powerup bs.Texture.

bascenev1lib.actor.respawnicon module

Implements respawn icon actor.

class bascenev1lib.actor.respawnicon.RespawnIcon(player: Player, respawn_time: float)[source]

Bases: object

An icon with a countdown that appears alongside the screen.

category: Gameplay Classes

This is used to indicate that a bascenev1.Player is waiting to respawn.

property visible: bool

Is this icon still visible?

bascenev1lib.actor.scoreboard module

Defines ScoreBoard Actor and related functionality.

class bascenev1lib.actor.scoreboard.Scoreboard(label: bs.Lstr | None = None, score_split: float = 0.7, pos: Sequence[float] | None = None, width: float | None = None, height: float | None = None)[source]

Bases: object

A display for player or team scores during a game.

category: Gameplay Classes

remove_team(team_id: int) None[source]

Remove the team with the given id from the scoreboard.

set_team_value(team: Team, score: float, max_score: float | None = None, *, countdown: bool = False, flash: bool = True, show_value: bool = True) None[source]

Update the score-board display for the given bs.Team.

bascenev1lib.actor.spawner module

Defines some lovely Actor(s).

class bascenev1lib.actor.spawner.Spawner(*, data: Any = None, pt: Sequence[float] = (0, 0, 0), spawn_time: float = 1.0, send_spawn_message: bool = True, spawn_callback: Callable[[], Any] | None = None)[source]

Bases: object

Utility for delayed spawning of objects.

Category: Gameplay Classes

Creates a light flash and sends a Spawner.SpawnMessage to the current activity after a delay.

class SpawnMessage(spawner: Spawner, data: Any, pt: Sequence[float])[source]

Bases: object

Spawn message sent by a Spawner after its delay has passed.

Category: Message Classes

data: Any

The data object passed by the user.

pt: Sequence[float]

The spawn position.

spawner: Spawner

The bascenev1.Spawner we came from.

bascenev1lib.actor.spaz module

Defines the spaz actor.

class bascenev1lib.actor.spaz.BombDiedMessage[source]

Bases: object

A bomb has died and thus can be recycled.

class bascenev1lib.actor.spaz.CurseExplodeMessage[source]

Bases: object

We are cursed and should blow up now.

class bascenev1lib.actor.spaz.PickupMessage[source]

Bases: object

We wanna pick something up.

class bascenev1lib.actor.spaz.PunchHitMessage[source]

Bases: object

Message saying an object was hit.

class bascenev1lib.actor.spaz.Spaz(*, color: Sequence[float] = (1.0, 1.0, 1.0), highlight: Sequence[float] = (0.5, 0.5, 0.5), character: str = 'Spaz', source_player: bs.Player | None = None, start_invincible: bool = True, can_accept_powerups: bool = True, powerups_expire: bool = False, demo_mode: bool = False)[source]

Bases: Actor

Base class for various Spazzes.

Category: Gameplay Classes

A Spaz is the standard little humanoid character in the game. It can be controlled by a player or by AI, and can have various different appearances. The name ‘Spaz’ is not to be confused with the ‘Spaz’ character in the game, which is just one of the skins available for instances of this class.

add_dropped_bomb_callback(call: Callable[[Spaz, bs.Actor], Any]) None[source]

Add a call to be run whenever this Spaz drops a bomb. The spaz and the newly-dropped bomb are passed as arguments.

curse() None[source]

Give this poor spaz a curse; he will explode in 5 seconds.

curse_explode(source_player: Player | None = None) None[source]

Explode the poor spaz spectacularly.

curse_time: float | None = 5.0
default_bomb_count = 1
default_bomb_type = 'normal'
default_boxing_gloves = False
default_hitpoints = 1000
default_shields = False
drop_bomb() Bomb | None[source]

Tell the spaz to drop one of his bombs, and returns the resulting bomb object. If the spaz has no bombs or is otherwise unable to drop a bomb, returns None.

equip_boxing_gloves() None[source]

Give this spaz some boxing gloves.

equip_shields(decay: bool = False) None[source]

Give this spaz a nice energy shield.

exists() bool[source]

Returns whether the Actor is still present in a meaningful way.

Note that a dying character should still return True here as long as their corpse is visible; this is about presence, not being ‘alive’ (see bascenev1.Actor.is_alive() for that).

If this returns False, it is assumed the Actor can be completely deleted without affecting the game; this call is often used when pruning lists of Actors, such as with bascenev1.Actor.autoretain()

The default implementation of this method always return True.

Note that the boolean operator for the Actor class calls this method, so a simple “if myactor” test will conveniently do the right thing even if myactor is set to None.

get_death_points(how: DeathType) tuple[int, int][source]

Get the points awarded for killing this spaz.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

is_alive() bool[source]

Method override; returns whether ol’ spaz is still kickin’.

node: bs.Node

The ‘spaz’ bs.Node.

on_bomb_press() None[source]

Called to ‘press bomb’ on this spaz; used for player or AI connections.

on_bomb_release() None[source]

Called to ‘release bomb’ on this spaz; used for player or AI connections.

on_expire() None[source]

Called for remaining `bascenev1.Actor`s when their activity dies.

Actors can use this opportunity to clear callbacks or other references which have the potential of keeping the bascenev1.Activity alive inadvertently (Activities can not exit cleanly while any Python references to them remain.)

Once an actor is expired (see bascenev1.Actor.is_expired()) it should no longer perform any game-affecting operations (creating, modifying, or deleting nodes, media, timers, etc.) Attempts to do so will likely result in errors.

on_fly_press() None[source]

Called to ‘press fly’ on this spaz; used for player or AI connections.

on_fly_release() None[source]

Called to ‘release fly’ on this spaz; used for player or AI connections.

on_hold_position_press() None[source]

Called to ‘press hold-position’ on this spaz; used for player or AI connections.

on_hold_position_release() None[source]

Called to ‘release hold-position’ on this spaz; used for player or AI connections.

on_jump_press() None[source]

Called to ‘press jump’ on this spaz; used by player or AI connections.

on_jump_release() None[source]

Called to ‘release jump’ on this spaz; used by player or AI connections.

on_move(x: float, y: float) None[source]

Called to set the joystick amount for this spaz; used for player or AI connections.

on_move_left_right(value: float) None[source]

Called to set the left/right joystick amount on this spaz; used for player or AI connections. value will be between -32768 to 32767 WARNING: deprecated; use on_move instead.

on_move_up_down(value: float) None[source]

Called to set the up/down joystick amount on this spaz; used for player or AI connections. value will be between -32768 to 32767 WARNING: deprecated; use on_move instead.

on_pickup_press() None[source]

Called to ‘press pick-up’ on this spaz; used by player or AI connections.

on_pickup_release() None[source]

Called to ‘release pick-up’ on this spaz; used by player or AI connections.

on_punch_press() None[source]

Called to ‘press punch’ on this spaz; used for player or AI connections.

on_punch_release() None[source]

Called to ‘release punch’ on this spaz; used for player or AI connections.

on_punched(damage: int) None[source]

Called when this spaz gets punched.

on_run(value: float) None[source]

Called to ‘press run’ on this spaz; used for player or AI connections.

points_mult = 1
set_bomb_count(count: int) None[source]

Sets the number of bombs this Spaz has.

set_land_mine_count(count: int) None[source]

Set the number of land-mines this spaz is carrying.

set_score_text(text: str | bs.Lstr, color: Sequence[float] = (1.0, 1.0, 0.4), flash: bool = False) None[source]

Utility func to show a message momentarily over our spaz that follows him around; Handy for score updates and things.

shatter(extreme: bool = False) None[source]

Break the poor spaz into little bits.

shield_decay() None[source]

Called repeatedly to decay shield HP over time.

bascenev1lib.actor.spazappearance module

Appearance functionality for spazzes.

class bascenev1lib.actor.spazappearance.Appearance(name: str)[source]

Bases: object

Create and fill out one of these suckers to define a spaz appearance.

bascenev1lib.actor.spazappearance.get_appearances(include_locked: bool = False) list[str][source]

Get the list of available spaz appearances.

bascenev1lib.actor.spazappearance.register_appearances() None[source]

Register our builtin spaz appearances.

bascenev1lib.actor.spazbot module

Bot versions of Spaz.

class bascenev1lib.actor.spazbot.BomberBot[source]

Bases: SpazBot

A bot that throws regular bombs and occasionally punches.

category: Bot Classes

character = 'Spaz'
punchiness = 0.3
class bascenev1lib.actor.spazbot.BomberBotLite[source]

Bases: BomberBot

A less aggressive yellow version of bs.BomberBot.

category: Bot Classes

charge_speed_max = 0.6
charge_speed_min = 0.6
color = (1.2, 0.9, 0.2)
highlight = (1.0, 0.5, 0.6)
punchiness = 0.2
throw_rate = 0.7
throwiness = 0.1
class bascenev1lib.actor.spazbot.BomberBotPro[source]

Bases: BomberBot

A more powerful version of bs.BomberBot.

category: Bot Classes

color = (1.0, 0.2, 0.1)
default_bomb_count = 3
default_boxing_gloves = True
highlight = (0.6, 0.1, 0.05)
points_mult = 2
punchiness = 0.7
run = True
run_dist_min = 6.0
throw_rate = 1.3
class bascenev1lib.actor.spazbot.BomberBotProShielded[source]

Bases: BomberBotPro

A more powerful version of bs.BomberBot who starts with shields.

category: Bot Classes

default_shields = True
points_mult = 3
class bascenev1lib.actor.spazbot.BomberBotProStatic[source]

Bases: BomberBotPro

A more powerful bs.BomberBot who generally stays in one place.

category: Bot Classes

static = True
throw_dist_min = 0.0
class bascenev1lib.actor.spazbot.BomberBotProStaticShielded[source]

Bases: BomberBotProShielded

A powerful bs.BomberBot with shields who is generally immobile.

category: Bot Classes

static = True
throw_dist_min = 0.0
class bascenev1lib.actor.spazbot.BomberBotStatic[source]

Bases: BomberBot

A version of bs.BomberBot who generally stays in one place.

category: Bot Classes

static = True
throw_dist_min = 0.0
class bascenev1lib.actor.spazbot.BomberBotStaticLite[source]

Bases: BomberBotLite

A less aggressive generally immobile weak version of bs.BomberBot.

category: Bot Classes

static = True
throw_dist_min = 0.0
class bascenev1lib.actor.spazbot.BouncyBot[source]

Bases: SpazBot

A speedy attacking melee bot that jumps constantly.

category: Bot Classes

bouncy = True
character = 'Easter Bunny'
charge_dist_max = 9999.0
charge_dist_min = 10.0
charge_speed_max = 1.0
charge_speed_min = 1.0
color = (1, 1, 1)
default_boxing_gloves = True
highlight = (1.0, 0.5, 0.5)
points_mult = 2
punchiness = 1.0
run = True
throw_dist_max = 9999
throw_dist_min = 9999
class bascenev1lib.actor.spazbot.BrawlerBot[source]

Bases: SpazBot

A bot who walks and punches things.

category: Bot Classes

character = 'Kronk'
charge_dist_max = 9999.0
charge_speed_max = 1.0
charge_speed_min = 1.0
punchiness = 0.9
throw_dist_max = 9999
throw_dist_min = 9999
class bascenev1lib.actor.spazbot.BrawlerBotLite[source]

Bases: BrawlerBot

A weaker version of bs.BrawlerBot.

category: Bot Classes

charge_speed_max = 0.6
charge_speed_min = 0.6
color = (1.2, 0.9, 0.2)
highlight = (1.0, 0.5, 0.6)
punchiness = 0.3
class bascenev1lib.actor.spazbot.BrawlerBotPro[source]

Bases: BrawlerBot

A stronger version of bs.BrawlerBot.

category: Bot Classes

color = (1.0, 0.2, 0.1)
default_boxing_gloves = True
highlight = (0.6, 0.1, 0.05)
points_mult = 2
punchiness = 0.95
run = True
run_dist_min = 4.0
class bascenev1lib.actor.spazbot.BrawlerBotProShielded[source]

Bases: BrawlerBotPro

A stronger version of bs.BrawlerBot who starts with shields.

category: Bot Classes

default_shields = True
points_mult = 3
class bascenev1lib.actor.spazbot.ChargerBot[source]

Bases: SpazBot

A speedy melee attack bot.

category: Bot Classes

character = 'Snake Shadow'
charge_dist_max = 9999.0
charge_dist_min = 10.0
charge_speed_max = 1.0
charge_speed_min = 1.0
points_mult = 2
punchiness = 1.0
run = True
throw_dist_max = 9999
throw_dist_min = 9999
class bascenev1lib.actor.spazbot.ChargerBotPro[source]

Bases: ChargerBot

A stronger bs.ChargerBot.

category: Bot Classes

color = (1.0, 0.2, 0.1)
default_boxing_gloves = True
highlight = (0.6, 0.1, 0.05)
points_mult = 3
class bascenev1lib.actor.spazbot.ChargerBotProShielded[source]

Bases: ChargerBotPro

A stronger bs.ChargerBot who starts with shields.

category: Bot Classes

default_shields = True
points_mult = 4
class bascenev1lib.actor.spazbot.ExplodeyBot[source]

Bases: SpazBot

A bot who runs and explodes in 5 seconds.

category: Bot Classes

character = 'Jack Morgan'
charge_dist_max = 9999
charge_dist_min = 0.0
charge_speed_max = 1.0
charge_speed_min = 1.0
points_mult = 4
run = True
start_cursed = True
throw_dist_max = 9999
throw_dist_min = 9999
class bascenev1lib.actor.spazbot.ExplodeyBotNoTimeLimit[source]

Bases: ExplodeyBot

A bot who runs but does not explode on his own.

category: Bot Classes

curse_time: float | None = None
class bascenev1lib.actor.spazbot.ExplodeyBotShielded[source]

Bases: ExplodeyBot

A bs.ExplodeyBot who starts with shields.

category: Bot Classes

default_shields = True
points_mult = 5
class bascenev1lib.actor.spazbot.SpazBot[source]

Bases: Spaz

A really dumb AI version of bs.Spaz.

Category: Bot Classes

Add these to a bs.BotSet to use them.

Note: currently the AI has no real ability to navigate obstacles and so should only be used on wide-open maps.

When a SpazBot is killed, it delivers a bs.SpazBotDiedMessage to the current activity.

When a SpazBot is punched, it delivers a bs.SpazBotPunchedMessage to the current activity.

bouncy = False
character = 'Spaz'
charge_dist_max = 2.0
charge_dist_min = 0.0
charge_speed_max = 1.0
charge_speed_min = 0.4
color = (0.6, 0.6, 0.6)
default_bomb_count = 3
default_bomb_type = 'normal'
handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

highlight = (0.1, 0.3, 0.1)
property map: Map

The map this bot was created on.

on_expire() None[source]

Called for remaining `bascenev1.Actor`s when their activity dies.

Actors can use this opportunity to clear callbacks or other references which have the potential of keeping the bascenev1.Activity alive inadvertently (Activities can not exit cleanly while any Python references to them remain.)

Once an actor is expired (see bascenev1.Actor.is_expired()) it should no longer perform any game-affecting operations (creating, modifying, or deleting nodes, media, timers, etc.) Attempts to do so will likely result in errors.

on_punched(damage: int) None[source]

Method override; sends bs.SpazBotPunchedMessage to the current activity.

punchiness = 0.5
run = False
run_dist_min = 0.0
set_player_points(pts: list[tuple[Vec3, Vec3]]) None[source]

Provide the spaz-bot with the locations of its enemies.

start_cursed = False
static = False
throw_dist_max = 9.0
throw_dist_min = 5.0
throw_rate = 1.0
throwiness = 0.7
update_ai() None[source]

Should be called periodically to update the spaz’ AI.

class bascenev1lib.actor.spazbot.SpazBotDiedMessage(spazbot: SpazBot, killerplayer: Player | None, how: DeathType)[source]

Bases: object

A message saying a bs.SpazBot has died.

Category: Message Classes

how: DeathType

The particular type of death.

killerplayer: Player | None

The bascenev1.Player that killed it (or None).

spazbot: SpazBot

The SpazBot that was killed.

class bascenev1lib.actor.spazbot.SpazBotPunchedMessage(spazbot: SpazBot, damage: int)[source]

Bases: object

A message saying a bs.SpazBot got punched.

Category: Message Classes

damage: int

How much damage was done to the SpazBot.

spazbot: SpazBot

The bs.SpazBot that got punched.

class bascenev1lib.actor.spazbot.SpazBotSet[source]

Bases: object

A container/controller for one or more bs.SpazBots.

category: Bot Classes

add_bot(bot: SpazBot) None[source]

Add a bs.SpazBot instance to the set.

celebrate(duration: float) None[source]

Tell all living bots in the set to celebrate momentarily.

Duration is given in seconds.

clear() None[source]

Immediately clear out any bots in the set.

final_celebrate() None[source]

Tell all bots in the set to stop what they were doing and celebrate.

Use this when the bots have won a game.

get_living_bots() list[SpazBot][source]

Get the living bots in the set.

have_living_bots() bool[source]

Return whether any bots in the set are alive or spawning.

spawn_bot(bot_type: type[SpazBot], pos: Sequence[float], spawn_time: float = 3.0, on_spawn_call: Callable[[SpazBot], Any] | None = None) None[source]

Spawn a bot from this set.

start_moving() None[source]

Start processing bot AI updates so they start doing their thing.

stop_moving() None[source]

Tell all bots to stop moving and stops updating their AI.

Useful when players have won and you want the enemy bots to just stand and look bewildered.

class bascenev1lib.actor.spazbot.StickyBot[source]

Bases: SpazBot

A crazy bot who runs and throws sticky bombs.

category: Bot Classes

character = 'Mel'
charge_dist_max = 10.0
charge_dist_min = 4.0
charge_speed_max = 1.0
charge_speed_min = 1.0
default_bomb_count = 3
default_bomb_type = 'sticky'
points_mult = 3
punchiness = 0.9
run = True
throw_dist_max = 4.0
throw_dist_min = 0.0
throw_rate = 2.0
throwiness = 1.0
class bascenev1lib.actor.spazbot.StickyBotStatic[source]

Bases: StickyBot

A crazy bot who throws sticky-bombs but generally stays in one place.

category: Bot Classes

static = True
class bascenev1lib.actor.spazbot.TriggerBot[source]

Bases: SpazBot

A slow moving bot with trigger bombs.

category: Bot Classes

character = 'Zoe'
charge_dist_max = 1.0
charge_speed_max = 0.5
charge_speed_min = 0.3
default_bomb_type = 'impact'
points_mult = 2
punchiness = 0.75
throw_dist_max = 5.5
throw_dist_min = 3.5
throwiness = 0.7
class bascenev1lib.actor.spazbot.TriggerBotPro[source]

Bases: TriggerBot

A stronger version of bs.TriggerBot.

category: Bot Classes

charge_speed_max = 1.0
charge_speed_min = 1.0
color = (1.0, 0.2, 0.1)
default_bomb_count = 3
default_boxing_gloves = True
highlight = (0.6, 0.1, 0.05)
points_mult = 3
punchiness = 0.9
run = True
run_dist_min = 6.0
throw_rate = 1.3
class bascenev1lib.actor.spazbot.TriggerBotProShielded[source]

Bases: TriggerBotPro

A stronger version of bs.TriggerBot who starts with shields.

category: Bot Classes

default_shields = True
points_mult = 4
class bascenev1lib.actor.spazbot.TriggerBotStatic[source]

Bases: TriggerBot

A bs.TriggerBot who generally stays in one place.

category: Bot Classes

static = True
throw_dist_min = 0.0

bascenev1lib.actor.spazfactory module

Provides a factory object from creating Spazzes.

class bascenev1lib.actor.spazfactory.SpazFactory[source]

Bases: object

Wraps up media and other resources used by bs.Spaz instances.

Category: Gameplay Classes

Generally one of these is created per bascenev1.Activity and shared between all spaz instances. Use bs.Spaz.get_factory() to return the shared factory for the current activity.

block_sound: bs.Sound

A bs.Sound for when an attack is blocked by invincibility.

curse_material: bs.Material

A bs.Material applied to a cursed bs.Spaz that triggers an explosion.

classmethod get() SpazFactory[source]

Return the shared bs.SpazFactory, creating it if necessary.

get_media(character: str) dict[str, Any][source]

Return the set of media used by this variant of spaz.

get_style(character: str) str[source]

Return the named style for this character.

(this influences subtle aspects of their appearance, etc)

impact_sounds_hard: Sequence[bs.Sound]

A tuple of bs.Sound-s for when a bs.Spaz hits something really hard.

impact_sounds_harder: Sequence[bs.Sound]

A tuple of bs.Sound-s for when a bs.Spaz hits something really really hard.

impact_sounds_medium: Sequence[bs.Sound]

A tuple of bs.Sound-s for when a bs.Spaz hits something kinda hard.

pickup_material: bs.Material

A bs.Material applied to the ‘grabber’ body of a bs.Spaz.

punch_material: bs.Material

A bs.Material applied to the ‘fist’ of a bs.Spaz.

punch_sound: bs.Sound

A standard punch bs.Sound.

punch_sound_strong: Sequence[bs.Sound]

A tuple of stronger sounding punch bs.Sounds.

punch_sound_stronger: bs.Sound

A really really strong sounding punch bs.Sound.

punch_sound_weak: bs.Sound

A weak punch bs.Sound.

roller_material: bs.Material

A bs.Material applied to the invisible roller ball body that a bs.Spaz uses for locomotion.

shatter_sound: bs.Sound

A bs.Sound for when a frozen bs.Spaz shatters.

single_player_death_sound: bs.Sound

The sound that plays for an ‘important’ spaz death such as in co-op games.

spaz_material: bs.Material

A bs.Material applied to all of parts of a bs.Spaz.

splatter_sound: bs.Sound

A bs.Sound for when a bs.Spaz blows up via curse.

swish_sound: bs.Sound

A punch swish bs.Sound.

bascenev1lib.actor.text module

Defines Actor(s).

class bascenev1lib.actor.text.Text(text: str | bs.Lstr, *, position: tuple[float, float] = (0.0, 0.0), h_align: HAlign = HAlign.LEFT, v_align: VAlign = VAlign.NONE, color: Sequence[float] = (1.0, 1.0, 1.0, 1.0), transition: Transition | None = None, transition_delay: float = 0.0, flash: bool = False, v_attach: VAttach = VAttach.CENTER, h_attach: HAttach = HAttach.CENTER, scale: float = 1.0, transition_out_delay: float | None = None, maxwidth: float | None = None, shadow: float = 0.5, flatness: float = 0.0, vr_depth: float = 0.0, host_only: bool = False, front: bool = False)[source]

Bases: Actor

Text with some tricks.

class HAlign(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Horizontal alignment type.

CENTER = 'center'
LEFT = 'left'
RIGHT = 'right'
class HAttach(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Horizontal attach type.

CENTER = 'center'
LEFT = 'left'
RIGHT = 'right'
class Transition(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Transition types for text.

FADE_IN = 'fade_in'
IN_BOTTOM = 'in_bottom'
IN_BOTTOM_SLOW = 'in_bottom_slow'
IN_LEFT = 'in_left'
IN_RIGHT = 'in_right'
IN_TOP_SLOW = 'in_top_slow'
class VAlign(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Vertical alignment type.

CENTER = 'center'
NONE = 'none'
class VAttach(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Vertical attach type.

BOTTOM = 'bottom'
CENTER = 'center'
TOP = 'top'
handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

bascenev1lib.actor.tipstext module

Provides tip related Actor(s).

class bascenev1lib.actor.tipstext.TipsText(offs_y: float = 100.0)[source]

Bases: Actor

A bit of text showing various helpful game tips.

change_phrase() None[source]

Switch the visible tip phrase.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

bascenev1lib.actor.zoomtext module

Defined Actor(s).

class bascenev1lib.actor.zoomtext.ZoomText(text: str | bs.Lstr, position: tuple[float, float] = (0.0, 0.0), *, shiftposition: tuple[float, float] | None = None, shiftdelay: float | None = None, lifespan: float | None = None, flash: bool = True, trail: bool = True, h_align: str = 'center', color: Sequence[float] = (0.9, 0.4, 0.0), jitter: float = 0.0, trailcolor: Sequence[float] = (1.0, 0.35, 0.1, 0.0), scale: float = 1.0, project_scale: float = 1.0, tilt_translate: float = 0.0, maxwidth: float | None = None)[source]

Bases: Actor

Big Zooming Text.

Category: Gameplay Classes

Used for things such as the ‘BOB WINS’ victory messages.

handlemessage(msg: Any) Any[source]

General message handling; can be passed any message object.

Module contents

Our lovely collection of actor related modules.