ballistica/docs/ba_module.md

5994 lines
279 KiB
Markdown

<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-04-07 for Ballistica version 1.5.0 build 20001</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>
<h2>Table of Contents</h2>
<h4><a name="class_category_Gameplay_Classes">Gameplay Classes</a></h4>
<ul>
<li><a href="#class_ba_Activity">ba.Activity</a></li>
<ul>
<li><a href="#class_ba_GameActivity">ba.GameActivity</a></li>
<ul>
<li><a href="#class_ba_CoopGameActivity">ba.CoopGameActivity</a></li>
<li><a href="#class_ba_TeamGameActivity">ba.TeamGameActivity</a></li>
</ul>
</ul>
<li><a href="#class_ba_Actor">ba.Actor</a></li>
<ul>
<li><a href="#class_ba_Map">ba.Map</a></li>
<li><a href="#class_ba_NodeActor">ba.NodeActor</a></li>
</ul>
<li><a href="#class_ba_Chooser">ba.Chooser</a></li>
<li><a href="#class_ba_InputDevice">ba.InputDevice</a></li>
<li><a href="#class_ba_Level">ba.Level</a></li>
<li><a href="#class_ba_Lobby">ba.Lobby</a></li>
<li><a href="#class_ba_Material">ba.Material</a></li>
<li><a href="#class_ba_Node">ba.Node</a></li>
<li><a href="#class_ba_Player">ba.Player</a></li>
<li><a href="#class_ba_PlayerRecord">ba.PlayerRecord</a></li>
<li><a href="#class_ba_Session">ba.Session</a></li>
<ul>
<li><a href="#class_ba_CoopSession">ba.CoopSession</a></li>
<li><a href="#class_ba_TeamBaseSession">ba.TeamBaseSession</a></li>
<ul>
<li><a href="#class_ba_FreeForAllSession">ba.FreeForAllSession</a></li>
<li><a href="#class_ba_TeamsSession">ba.TeamsSession</a></li>
</ul>
</ul>
<li><a href="#class_ba_Stats">ba.Stats</a></li>
<li><a href="#class_ba_Team">ba.Team</a></li>
<li><a href="#class_ba_TeamGameResults">ba.TeamGameResults</a></li>
</ul>
<h4><a name="function_category_Gameplay_Functions">Gameplay Functions</a></h4>
<ul>
<li><a href="#function_ba_animate">ba.animate()</a></li>
<li><a href="#function_ba_animate_array">ba.animate_array()</a></li>
<li><a href="#function_ba_cameraflash">ba.cameraflash()</a></li>
<li><a href="#function_ba_camerashake">ba.camerashake()</a></li>
<li><a href="#function_ba_emitfx">ba.emitfx()</a></li>
<li><a href="#function_ba_get_collision_info">ba.get_collision_info()</a></li>
<li><a href="#function_ba_getactivity">ba.getactivity()</a></li>
<li><a href="#function_ba_getnodes">ba.getnodes()</a></li>
<li><a href="#function_ba_getsession">ba.getsession()</a></li>
<li><a href="#function_ba_newnode">ba.newnode()</a></li>
<li><a href="#function_ba_playsound">ba.playsound()</a></li>
<li><a href="#function_ba_printnodes">ba.printnodes()</a></li>
<li><a href="#function_ba_setmusic">ba.setmusic()</a></li>
<li><a href="#function_ba_sharedobj">ba.sharedobj()</a></li>
<li><a href="#function_ba_show_damage_count">ba.show_damage_count()</a></li>
</ul>
<h4><a name="class_category_General_Utility_Classes">General Utility Classes</a></h4>
<ul>
<li><a href="#class_ba_Call">ba.Call</a></li>
<li><a href="#class_ba_Context">ba.Context</a></li>
<li><a href="#class_ba_ContextCall">ba.ContextCall</a></li>
<li><a href="#class_ba_Lstr">ba.Lstr</a></li>
<li><a href="#class_ba_Timer">ba.Timer</a></li>
<li><a href="#class_ba_Vec3">ba.Vec3</a></li>
<li><a href="#class_ba_WeakCall">ba.WeakCall</a></li>
</ul>
<h4><a name="function_category_General_Utility_Functions">General Utility Functions</a></h4>
<ul>
<li><a href="#function_ba_charstr">ba.charstr()</a></li>
<li><a href="#function_ba_do_once">ba.do_once()</a></li>
<li><a href="#function_ba_get_valid_languages">ba.get_valid_languages()</a></li>
<li><a href="#function_ba_is_browser_likely_available">ba.is_browser_likely_available()</a></li>
<li><a href="#function_ba_is_point_in_box">ba.is_point_in_box()</a></li>
<li><a href="#function_ba_log">ba.log()</a></li>
<li><a href="#function_ba_new_activity">ba.new_activity()</a></li>
<li><a href="#function_ba_normalized_color">ba.normalized_color()</a></li>
<li><a href="#function_ba_open_url">ba.open_url()</a></li>
<li><a href="#function_ba_print_error">ba.print_error()</a></li>
<li><a href="#function_ba_print_exception">ba.print_exception()</a></li>
<li><a href="#function_ba_printobjects">ba.printobjects()</a></li>
<li><a href="#function_ba_pushcall">ba.pushcall()</a></li>
<li><a href="#function_ba_quit">ba.quit()</a></li>
<li><a href="#function_ba_safecolor">ba.safecolor()</a></li>
<li><a href="#function_ba_screenmessage">ba.screenmessage()</a></li>
<li><a href="#function_ba_set_analytics_screen">ba.set_analytics_screen()</a></li>
<li><a href="#function_ba_setlanguage">ba.setlanguage()</a></li>
<li><a href="#function_ba_time">ba.time()</a></li>
<li><a href="#function_ba_timer">ba.timer()</a></li>
<li><a href="#function_ba_timestring">ba.timestring()</a></li>
<li><a href="#function_ba_vec3validate">ba.vec3validate()</a></li>
</ul>
<h4><a name="class_category_Asset_Classes">Asset Classes</a></h4>
<ul>
<li><a href="#class_ba_AssetPackage">ba.AssetPackage</a></li>
<li><a href="#class_ba_CollideModel">ba.CollideModel</a></li>
<li><a href="#class_ba_Data">ba.Data</a></li>
<li><a href="#class_ba_Model">ba.Model</a></li>
<li><a href="#class_ba_Sound">ba.Sound</a></li>
<li><a href="#class_ba_Texture">ba.Texture</a></li>
</ul>
<h4><a name="function_category_Asset_Functions">Asset Functions</a></h4>
<ul>
<li><a href="#function_ba_getcollidemodel">ba.getcollidemodel()</a></li>
<li><a href="#function_ba_getmaps">ba.getmaps()</a></li>
<li><a href="#function_ba_getmodel">ba.getmodel()</a></li>
<li><a href="#function_ba_getsound">ba.getsound()</a></li>
<li><a href="#function_ba_gettexture">ba.gettexture()</a></li>
</ul>
<h4><a name="class_category_Message_Classes">Message Classes</a></h4>
<ul>
<li><a href="#class_ba_CelebrateMessage">ba.CelebrateMessage</a></li>
<li><a href="#class_ba_DieMessage">ba.DieMessage</a></li>
<li><a href="#class_ba_DropMessage">ba.DropMessage</a></li>
<li><a href="#class_ba_DroppedMessage">ba.DroppedMessage</a></li>
<li><a href="#class_ba_FreezeMessage">ba.FreezeMessage</a></li>
<li><a href="#class_ba_HitMessage">ba.HitMessage</a></li>
<li><a href="#class_ba_ImpactDamageMessage">ba.ImpactDamageMessage</a></li>
<li><a href="#class_ba_OutOfBoundsMessage">ba.OutOfBoundsMessage</a></li>
<li><a href="#class_ba_PickedUpMessage">ba.PickedUpMessage</a></li>
<li><a href="#class_ba_PickUpMessage">ba.PickUpMessage</a></li>
<li><a href="#class_ba_PlayerScoredMessage">ba.PlayerScoredMessage</a></li>
<li><a href="#class_ba_PowerupAcceptMessage">ba.PowerupAcceptMessage</a></li>
<li><a href="#class_ba_PowerupMessage">ba.PowerupMessage</a></li>
<li><a href="#class_ba_ShouldShatterMessage">ba.ShouldShatterMessage</a></li>
<li><a href="#class_ba_StandMessage">ba.StandMessage</a></li>
<li><a href="#class_ba_ThawMessage">ba.ThawMessage</a></li>
</ul>
<h4><a name="class_category_App_Classes">App Classes</a></h4>
<ul>
<li><a href="#class_ba_Achievement">ba.Achievement</a></li>
<li><a href="#class_ba_App">ba.App</a></li>
<li><a href="#class_ba_AppConfig">ba.AppConfig</a></li>
<li><a href="#class_ba_AppDelegate">ba.AppDelegate</a></li>
<li><a href="#class_ba_Campaign">ba.Campaign</a></li>
<li><a href="#class_ba_MusicPlayer">ba.MusicPlayer</a></li>
</ul>
<h4><a name="class_category_User_Interface_Classes">User Interface Classes</a></h4>
<ul>
<li><a href="#class_ba_UIController">ba.UIController</a></li>
<li><a href="#class_ba_Widget">ba.Widget</a></li>
<li><a href="#class_ba_Window">ba.Window</a></li>
</ul>
<h4><a name="function_category_User_Interface_Functions">User Interface Functions</a></h4>
<ul>
<li><a href="#function_ba_buttonwidget">ba.buttonwidget()</a></li>
<li><a href="#function_ba_checkboxwidget">ba.checkboxwidget()</a></li>
<li><a href="#function_ba_columnwidget">ba.columnwidget()</a></li>
<li><a href="#function_ba_containerwidget">ba.containerwidget()</a></li>
<li><a href="#function_ba_hscrollwidget">ba.hscrollwidget()</a></li>
<li><a href="#function_ba_imagewidget">ba.imagewidget()</a></li>
<li><a href="#function_ba_rowwidget">ba.rowwidget()</a></li>
<li><a href="#function_ba_scrollwidget">ba.scrollwidget()</a></li>
<li><a href="#function_ba_textwidget">ba.textwidget()</a></li>
<li><a href="#function_ba_uicleanupcheck">ba.uicleanupcheck()</a></li>
<li><a href="#function_ba_widget">ba.widget()</a></li>
</ul>
<h4><a name="class_category_Dependency_Classes">Dependency Classes</a></h4>
<ul>
<li><a href="#class_ba_Dependency">ba.Dependency</a></li>
<li><a href="#class_ba_DependencyComponent">ba.DependencyComponent</a></li>
<li><a href="#class_ba_DependencySet">ba.DependencySet</a></li>
</ul>
<h4><a name="class_category_Enums">Enums</a></h4>
<ul>
<li><a href="#class_ba_DeathType">ba.DeathType</a></li>
<li><a href="#class_ba_MusicPlayMode">ba.MusicPlayMode</a></li>
<li><a href="#class_ba_MusicType">ba.MusicType</a></li>
<li><a href="#class_ba_Permission">ba.Permission</a></li>
<li><a href="#class_ba_SpecialChar">ba.SpecialChar</a></li>
<li><a href="#class_ba_TimeFormat">ba.TimeFormat</a></li>
<li><a href="#class_ba_TimeType">ba.TimeType</a></li>
</ul>
<h4><a name="class_category_Exception_Classes">Exception Classes</a></h4>
<ul>
<li><a href="#class_ba_DependencyError">ba.DependencyError</a></li>
<li><a href="#class_ba_NotFoundError">ba.NotFoundError</a></li>
<ul>
<li><a href="#class_ba_ActivityNotFoundError">ba.ActivityNotFoundError</a></li>
<li><a href="#class_ba_ActorNotFoundError">ba.ActorNotFoundError</a></li>
<li><a href="#class_ba_InputDeviceNotFoundError">ba.InputDeviceNotFoundError</a></li>
<li><a href="#class_ba_NodeNotFoundError">ba.NodeNotFoundError</a></li>
<li><a href="#class_ba_PlayerNotFoundError">ba.PlayerNotFoundError</a></li>
<li><a href="#class_ba_SessionNotFoundError">ba.SessionNotFoundError</a></li>
<li><a href="#class_ba_TeamNotFoundError">ba.TeamNotFoundError</a></li>
<li><a href="#class_ba_WidgetNotFoundError">ba.WidgetNotFoundError</a></li>
</ul>
</ul>
<hr>
<h2><strong><a name="class_ba_Achievement">ba.Achievement</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Represents attributes and state for an individual achievement.</p>
<p>Category: <a href="#class_category_App_Classes">App Classes</a>
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Achievement__complete">complete</a>, <a href="#attr_ba_Achievement__description">description</a>, <a href="#attr_ba_Achievement__description_complete">description_complete</a>, <a href="#attr_ba_Achievement__description_full">description_full</a>, <a href="#attr_ba_Achievement__description_full_complete">description_full_complete</a>, <a href="#attr_ba_Achievement__display_name">display_name</a>, <a href="#attr_ba_Achievement__hard_mode_only">hard_mode_only</a>, <a href="#attr_ba_Achievement__level_name">level_name</a>, <a href="#attr_ba_Achievement__name">name</a>, <a href="#attr_ba_Achievement__power_ranking_value">power_ranking_value</a></h5>
<dl>
<dt><h4><a name="attr_ba_Achievement__complete">complete</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether this Achievement is currently complete.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__description">description</a></h4></dt><dd>
<p><span><a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Get a <a href="#class_ba_Lstr">ba.Lstr</a> for the Achievement's brief description.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__description_complete">description_complete</a></h4></dt><dd>
<p><span><a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Get a <a href="#class_ba_Lstr">ba.Lstr</a> for the Achievement's description when completed.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__description_full">description_full</a></h4></dt><dd>
<p><span><a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Get a <a href="#class_ba_Lstr">ba.Lstr</a> for the Achievement's full description.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__description_full_complete">description_full_complete</a></h4></dt><dd>
<p><span><a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Get a <a href="#class_ba_Lstr">ba.Lstr</a> for the Achievement's full desc. when completed.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__display_name">display_name</a></h4></dt><dd>
<p><span><a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return a <a href="#class_ba_Lstr">ba.Lstr</a> for this Achievement's name.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__hard_mode_only">hard_mode_only</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether this Achievement is only unlockable in hard-mode.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__level_name">level_name</a></h4></dt><dd>
<p><span>str</span></p>
<p>The name of the level this achievement applies to.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__name">name</a></h4></dt><dd>
<p><span>str</span></p>
<p>The name of this achievement.</p>
</dd>
<dt><h4><a name="attr_ba_Achievement__power_ranking_value">power_ranking_value</a></h4></dt><dd>
<p><span>int</span></p>
<p>Get the power-ranking award value for this achievement.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Achievement____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Achievement__announce_completion">announce_completion()</a>, <a href="#method_ba_Achievement__create_display">create_display()</a>, <a href="#method_ba_Achievement__get_award_ticket_value">get_award_ticket_value()</a>, <a href="#method_ba_Achievement__get_icon_color">get_icon_color()</a>, <a href="#method_ba_Achievement__get_icon_texture">get_icon_texture()</a>, <a href="#method_ba_Achievement__set_complete">set_complete()</a>, <a href="#method_ba_Achievement__show_completion_banner">show_completion_banner()</a></h5>
<dl>
<dt><h4><a name="method_ba_Achievement____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Achievement(name: str, icon_name: str, icon_color: Sequence[float], level_name: str, award: int, hard_mode_only: bool = False)</span></p>
</dd>
<dt><h4><a name="method_ba_Achievement__announce_completion">announce_completion()</a></dt></h4><dd>
<p><span>announce_completion(self, sound: bool = True) -&gt; None</span></p>
<p>Kick off an announcement for this achievement's completion.</p>
</dd>
<dt><h4><a name="method_ba_Achievement__create_display">create_display()</a></dt></h4><dd>
<p><span>create_display(self, x: 'float', y: 'float', delay: 'float', outdelay: 'float' = None, color: 'Sequence[float]' = None, style: 'str' = 'post_game') -&gt; 'List[<a href="#class_ba_Actor">ba.Actor</a>]'</span></p>
<p>Create a display for the Achievement.</p>
<p>Shows the Achievement icon, name, and description.</p>
</dd>
<dt><h4><a name="method_ba_Achievement__get_award_ticket_value">get_award_ticket_value()</a></dt></h4><dd>
<p><span>get_award_ticket_value(self, include_pro_bonus: bool = False) -&gt; int</span></p>
<p>Get the ticket award value for this achievement.</p>
</dd>
<dt><h4><a name="method_ba_Achievement__get_icon_color">get_icon_color()</a></dt></h4><dd>
<p><span>get_icon_color(self, complete: bool) -&gt; Sequence[float]</span></p>
<p>Return the color tint for this Achievement's icon.</p>
</dd>
<dt><h4><a name="method_ba_Achievement__get_icon_texture">get_icon_texture()</a></dt></h4><dd>
<p><span>get_icon_texture(self, complete: bool) -&gt; <a href="#class_ba_Texture">ba.Texture</a></span></p>
<p>Return the icon texture to display for this achievement</p>
</dd>
<dt><h4><a name="method_ba_Achievement__set_complete">set_complete()</a></dt></h4><dd>
<p><span>set_complete(self, complete: bool = True) -&gt; None</span></p>
<p>Set an achievement's completed state.</p>
<p>note this only sets local state; use a transaction to
actually award achievements.</p>
</dd>
<dt><h4><a name="method_ba_Achievement__show_completion_banner">show_completion_banner()</a></dt></h4><dd>
<p><span>show_completion_banner(self, sound: bool = True) -&gt; None</span></p>
<p>Create the banner/sound for an acquired achievement announcement.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Activity">ba.Activity</a></strong></h3>
<p>inherits from: <a href="#class_ba_DependencyComponent">ba.DependencyComponent</a></p>
<p>Units of execution wrangled by a <a href="#class_ba_Session">ba.Session</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> Examples of Activities include games, score-screens, cutscenes, etc.
A <a href="#class_ba_Session">ba.Session</a> has one 'current' Activity at any time, though their existence
can overlap during transitions.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Activity__players">players</a>, <a href="#attr_ba_Activity__session">session</a>, <a href="#attr_ba_Activity__settings">settings</a>, <a href="#attr_ba_Activity__stats">stats</a>, <a href="#attr_ba_Activity__teams">teams</a></h5>
<dl>
<dt><h4><a name="attr_ba_Activity__players">players</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_Player">ba.Player</a>]</span></p>
<p>The list of <a href="#class_ba_Player">ba.Players</a> in the Activity. This gets populated just
before on_begin() is called and is updated automatically as players
join or leave the game.</p>
</dd>
<dt><h4><a name="attr_ba_Activity__session">session</a></h4></dt><dd>
<p><span><a href="#class_ba_Session">ba.Session</a></span></p>
<p>The <a href="#class_ba_Session">ba.Session</a> this <a href="#class_ba_Activity">ba.Activity</a> belongs go.</p>
<p> Raises a <a href="#class_ba_SessionNotFoundError">ba.SessionNotFoundError</a> if the Session no longer exists.</p>
</dd>
<dt><h4><a name="attr_ba_Activity__settings">settings</a></h4></dt><dd>
<p><span>Dict[str, Any]</span></p>
<p>The settings dict passed in when the activity was made.</p>
</dd>
<dt><h4><a name="attr_ba_Activity__stats">stats</a></h4></dt><dd>
<p><span><a href="#class_ba_Stats">ba.Stats</a></span></p>
<p>The stats instance accessible while the activity is running.</p>
<p> If access is attempted before or after, raises a <a href="#class_ba_NotFoundError">ba.NotFoundError</a>.</p>
</dd>
<dt><h4><a name="attr_ba_Activity__teams">teams</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_Team">ba.Team</a>]</span></p>
<p>The list of <a href="#class_ba_Team">ba.Teams</a> in the Activity. This gets populated just before
before on_begin() is called and is updated automatically as players
join or leave the game. (at least in free-for-all mode where every
player gets their own team; in teams mode there are always 2 teams
regardless of the player count).</p>
</dd>
</dl>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_DependencyComponent__dep_is_present">dep_is_present()</a>, <a href="#method_ba_DependencyComponent__get_dynamic_deps">get_dynamic_deps()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_Activity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Activity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_Activity__create_player_node">create_player_node()</a>, <a href="#method_ba_Activity__end">end()</a>, <a href="#method_ba_Activity__handlemessage">handlemessage()</a>, <a href="#method_ba_Activity__has_begun">has_begun()</a>, <a href="#method_ba_Activity__has_ended">has_ended()</a>, <a href="#method_ba_Activity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_Activity__is_expired">is_expired()</a>, <a href="#method_ba_Activity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_Activity__on_begin">on_begin()</a>, <a href="#method_ba_Activity__on_expire">on_expire()</a>, <a href="#method_ba_Activity__on_player_join">on_player_join()</a>, <a href="#method_ba_Activity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_Activity__on_team_join">on_team_join()</a>, <a href="#method_ba_Activity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Activity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_Activity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_Activity__retain_actor">retain_actor()</a></h5>
<dl>
<dt><h4><a name="method_ba_Activity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Activity(settings: Dict[str, Any])</span></p>
<p>Creates an activity in the current <a href="#class_ba_Session">ba.Session</a>.</p>
<p>The activity will not be actually run until <a href="#method_ba_Session__set_activity">ba.Session.set_activity</a>()
is called. 'settings' should be a dict of key/value pairs specific
to the activity.</p>
<p>Activities should preload as much of their media/etc as possible in
their constructor, but none of it should actually be used until they
are transitioned in.</p>
</dd>
<dt><h4><a name="method_ba_Activity__add_actor_weak_ref">add_actor_weak_ref()</a></dt></h4><dd>
<p><span>add_actor_weak_ref(self, actor: <a href="#class_ba_Actor">ba.Actor</a>) -&gt; None</span></p>
<p>Add a weak-reference to a <a href="#class_ba_Actor">ba.Actor</a> to the <a href="#class_ba_Activity">ba.Activity</a>.</p>
<p>(called by the <a href="#class_ba_Actor">ba.Actor</a> base class)</p>
</dd>
<dt><h4><a name="method_ba_Activity__create_player_node">create_player_node()</a></dt></h4><dd>
<p><span>create_player_node(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; <a href="#class_ba_Node">ba.Node</a></span></p>
<p>Create the 'player' node associated with the provided <a href="#class_ba_Player">ba.Player</a>.</p>
</dd>
<dt><h4><a name="method_ba_Activity__end">end()</a></dt></h4><dd>
<p><span>end(self, results: Any = None, delay: float = 0.0, force: bool = False) -&gt; None</span></p>
<p>Commences Activity shutdown and delivers results to the <a href="#class_ba_Session">ba.Session</a>.</p>
<p>'delay' is the time delay before the Activity actually ends
(in seconds). Further calls to end() will be ignored up until
this time, unless 'force' is True, in which case the new results
will replace the old.</p>
</dd>
<dt><h4><a name="method_ba_Activity__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(self, msg: Any) -&gt; Any</span></p>
<p>General message handling; can be passed any <a href="#class_category_Message_Classes">message object</a>.</p>
</dd>
<dt><h4><a name="method_ba_Activity__has_begun">has_begun()</a></dt></h4><dd>
<p><span>has_begun(self) -&gt; bool</span></p>
<p>Return whether on_begin() has been called.</p>
</dd>
<dt><h4><a name="method_ba_Activity__has_ended">has_ended()</a></dt></h4><dd>
<p><span>has_ended(self) -&gt; bool</span></p>
<p>Return whether the activity has commenced ending.</p>
</dd>
<dt><h4><a name="method_ba_Activity__has_transitioned_in">has_transitioned_in()</a></dt></h4><dd>
<p><span>has_transitioned_in(self) -&gt; bool</span></p>
<p>Return whether on_transition_in() has been called.</p>
</dd>
<dt><h4><a name="method_ba_Activity__is_expired">is_expired()</a></dt></h4><dd>
<p><span>is_expired(self) -&gt; bool</span></p>
<p>Return whether the activity is expired.</p>
<p>An activity is set as expired when shutting down.
At this point no new nodes, timers, etc should be made,
run, etc, and the activity should be considered a 'zombie'.</p>
</dd>
<dt><h4><a name="method_ba_Activity__is_transitioning_out">is_transitioning_out()</a></dt></h4><dd>
<p><span>is_transitioning_out(self) -&gt; bool</span></p>
<p>Return whether on_transition_out() has been called.</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_begin">on_begin()</a></dt></h4><dd>
<p><span>on_begin(self) -&gt; None</span></p>
<p>Called once the previous <a href="#class_ba_Activity">ba.Activity</a> has finished transitioning out.</p>
<p>At this point the activity's initial players and teams are filled in
and it should begin its actual game logic.</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_expire">on_expire()</a></dt></h4><dd>
<p><span>on_expire(self) -&gt; None</span></p>
<p>Called when your activity is being expired.</p>
<p>If your activity has created anything explicitly that may be retaining
a strong reference to the activity and preventing it from dying, you
should clear that out here. From this point on your activity's sole
purpose in life is to hit zero references and die so the next activity
can begin.</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_player_join">on_player_join()</a></dt></h4><dd>
<p><span>on_player_join(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Called when a new <a href="#class_ba_Player">ba.Player</a> has joined the Activity.</p>
<p>(including the initial set of Players)</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_player_leave">on_player_leave()</a></dt></h4><dd>
<p><span>on_player_leave(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Called when a <a href="#class_ba_Player">ba.Player</a> is leaving the Activity.</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_team_join">on_team_join()</a></dt></h4><dd>
<p><span>on_team_join(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; None</span></p>
<p>Called when a new <a href="#class_ba_Team">ba.Team</a> joins the Activity.</p>
<p>(including the initial set of Teams)</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_team_leave">on_team_leave()</a></dt></h4><dd>
<p><span>on_team_leave(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; None</span></p>
<p>Called when a <a href="#class_ba_Team">ba.Team</a> leaves the Activity.</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_transition_in">on_transition_in()</a></dt></h4><dd>
<p><span>on_transition_in(self) -&gt; None</span></p>
<p>Called when the Activity is first becoming visible.</p>
<p>Upon this call, the Activity should fade in backgrounds,
start playing music, etc. It does not yet have access to <a href="#class_ba_Player">ba.Players</a>
or <a href="#class_ba_Team">ba.Teams</a>, however. They remain owned by the previous Activity
up until <a href="#method_ba_Activity__on_begin">ba.Activity.on_begin</a>() is called.</p>
</dd>
<dt><h4><a name="method_ba_Activity__on_transition_out">on_transition_out()</a></dt></h4><dd>
<p><span>on_transition_out(self) -&gt; None</span></p>
<p>Called when your activity begins transitioning out.</p>
<p>Note that this may happen at any time even if finish() has not been
called.</p>
</dd>
<dt><h4><a name="method_ba_Activity__retain_actor">retain_actor()</a></dt></h4><dd>
<p><span>retain_actor(self, actor: <a href="#class_ba_Actor">ba.Actor</a>) -&gt; None</span></p>
<p>Add a strong-reference to a <a href="#class_ba_Actor">ba.Actor</a> to this Activity.</p>
<p>The reference will be lazily released once <a href="#method_ba_Actor__exists">ba.Actor.exists</a>()
returns False for the Actor. The <a href="#method_ba_Actor__autoretain">ba.Actor.autoretain</a>() method
is a convenient way to access this same functionality.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_ActivityNotFoundError">ba.ActivityNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_Activity">ba.Activity</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_Actor">ba.Actor</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>High level logical entities in a game/activity.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> Actors act as controllers, combining some number of <a href="#class_ba_Node">ba.Nodes</a>,
<a href="#class_ba_Texture">ba.Textures</a>, <a href="#class_ba_Sound">ba.Sounds</a>, etc. into a high-level cohesive unit.</p>
<p> Some example actors include Bomb, Flag, and Spaz classes in bastd.</p>
<p> One key feature of Actors is that they generally 'die'
(killing off or transitioning out their nodes) when the last Python
reference to them disappears, so you can use logic such as:</p>
<pre><span><em><small> # Create a flag Actor in our game activity:</small></em></span>
from bastd.actor.flag import Flag
self.flag = Flag(position=(0, 10, 0))</pre>
<pre><span><em><small> # Later, destroy the flag.</small></em></span>
<span><em><small> # (provided nothing else is holding a reference to it)</small></em></span>
<span><em><small> # We could also just assign a new flag to this value.</small></em></span>
<span><em><small> # Either way, the old flag disappears.</small></em></span>
self.flag = None</pre>
<p> This is in contrast to the behavior of the more low level <a href="#class_ba_Node">ba.Nodes</a>,
which are always explicitly created and destroyed and don't care
how many Python references to them exist.</p>
<p> Note, however, that you can use the <a href="#method_ba_Actor__autoretain">ba.Actor.autoretain</a>() method
if you want an Actor to stick around until explicitly killed
regardless of references.</p>
<p> Another key feature of <a href="#class_ba_Actor">ba.Actor</a> is its handlemessage() method, which
takes a single arbitrary object as an argument. This provides a safe way
to communicate between <a href="#class_ba_Actor">ba.Actor</a>, <a href="#class_ba_Activity">ba.Activity</a>, <a href="#class_ba_Session">ba.Session</a>, and any other
class providing a handlemessage() method. The most universally handled
message type for Actors is the <a href="#class_ba_DieMessage">ba.DieMessage</a>.</p>
<pre><span><em><small> # Another way to kill the flag from the example above:</small></em></span>
<span><em><small> # We can safely call this on any type with a 'handlemessage' method</small></em></span>
<span><em><small> # (though its not guaranteed to always have a meaningful effect).</small></em></span>
<span><em><small> # In this case the Actor instance will still be around, but its exists()</small></em></span>
<span><em><small> # and is_alive() methods will both return False.</small></em></span>
self.flag.handlemessage(<a href="#class_ba_DieMessage">ba.DieMessage</a>())
</pre>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_Actor__activity">activity</a></h4></dt><dd>
<p><span><a href="#class_ba_Activity">ba.Activity</a></span></p>
<p>The Activity this Actor was created in.</p>
<p> Raises a <a href="#class_ba_ActivityNotFoundError">ba.ActivityNotFoundError</a> if the Activity no longer exists.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Actor____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Actor__autoretain">autoretain()</a>, <a href="#method_ba_Actor__exists">exists()</a>, <a href="#method_ba_Actor__getactivity">getactivity()</a>, <a href="#method_ba_Actor__handlemessage">handlemessage()</a>, <a href="#method_ba_Actor__is_alive">is_alive()</a>, <a href="#method_ba_Actor__is_expired">is_expired()</a>, <a href="#method_ba_Actor__on_expire">on_expire()</a></h5>
<dl>
<dt><h4><a name="method_ba_Actor____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Actor()</span></p>
<p>Instantiates an Actor in the current <a href="#class_ba_Activity">ba.Activity</a>.</p>
</dd>
<dt><h4><a name="method_ba_Actor__autoretain">autoretain()</a></dt></h4><dd>
<p><span>autoretain(self: T) -&gt; T</span></p>
<p>Keep this Actor alive without needing to hold a reference to it.</p>
<p>This keeps the <a href="#class_ba_Actor">ba.Actor</a> in existence by storing a reference to it
with the <a href="#class_ba_Activity">ba.Activity</a> it was created in. The reference is lazily
released once <a href="#method_ba_Actor__exists">ba.Actor.exists</a>() returns False for it or when the
Activity is set as expired. This can be a convenient alternative
to storing references explicitly just to keep a <a href="#class_ba_Actor">ba.Actor</a> from dying.
For convenience, this method returns the <a href="#class_ba_Actor">ba.Actor</a> it is called with,
enabling chained statements such as: myflag = ba.Flag().autoretain()</p>
</dd>
<dt><h4><a name="method_ba_Actor__exists">exists()</a></dt></h4><dd>
<p><span>exists(self) -&gt; bool</span></p>
<p>Returns whether the Actor is still present in a meaningful way.</p>
<p>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 <a href="#method_ba_Actor__is_alive">ba.Actor.is_alive</a>() for that).</p>
<p>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 <a href="#method_ba_Actor__autoretain">ba.Actor.autoretain</a>()</p>
<p>The default implementation of this method always return True.</p>
<p>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.</p>
</dd>
<dt><h4><a name="method_ba_Actor__getactivity">getactivity()</a></dt></h4><dd>
<p><span>getactivity(self, doraise: bool = True) -&gt; Optional[<a href="#class_ba_Activity">ba.Activity</a>]</span></p>
<p>Return the <a href="#class_ba_Activity">ba.Activity</a> this Actor is associated with.</p>
<p>If the Activity no longer exists, raises a <a href="#class_ba_ActivityNotFoundError">ba.ActivityNotFoundError</a>
or returns None depending on whether 'doraise' is set.</p>
</dd>
<dt><h4><a name="method_ba_Actor__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(self, msg: Any) -&gt; Any</span></p>
<p>General message handling; can be passed any <a href="#class_category_Message_Classes">message object</a>.</p>
</dd>
<dt><h4><a name="method_ba_Actor__is_alive">is_alive()</a></dt></h4><dd>
<p><span>is_alive(self) -&gt; bool</span></p>
<p>Returns whether the Actor is 'alive'.</p>
<p>What this means is up to the Actor.
It is not a requirement for Actors to be
able to die; just that they report whether
they are Alive or not.</p>
</dd>
<dt><h4><a name="method_ba_Actor__is_expired">is_expired()</a></dt></h4><dd>
<p><span>is_expired(self) -&gt; bool</span></p>
<p>Returns whether the Actor is expired.</p>
<p>(see <a href="#method_ba_Actor__on_expire">ba.Actor.on_expire</a>())</p>
</dd>
<dt><h4><a name="method_ba_Actor__on_expire">on_expire()</a></dt></h4><dd>
<p><span>on_expire(self) -&gt; None</span></p>
<p>Called for remaining <a href="#class_ba_Actor">ba.Actors</a> when their <a href="#class_ba_Activity">ba.Activity</a> shuts down.</p>
<p>Actors can use this opportunity to clear callbacks
or other references which have the potential of keeping the
<a href="#class_ba_Activity">ba.Activity</a> alive inadvertently (Activities can not exit cleanly while
any Python references to them remain.)</p>
<p>Once an actor is expired (see <a href="#method_ba_Actor__is_expired">ba.Actor.is_expired</a>()) 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.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_ActorNotFoundError">ba.ActorNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_Actor">ba.Actor</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_App">ba.App</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A class for high level app functionality and state.</p>
<p>Category: <a href="#class_category_App_Classes">App Classes</a></p>
<p> Use ba.app to access the single shared instance of this class.</p>
<p> Note that properties not documented here should be considered internal
and subject to change without warning.
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_App__api_version">api_version</a>, <a href="#attr_ba_App__build_number">build_number</a>, <a href="#attr_ba_App__config">config</a>, <a href="#attr_ba_App__config_file_path">config_file_path</a>, <a href="#attr_ba_App__debug_build">debug_build</a>, <a href="#attr_ba_App__interface_type">interface_type</a>, <a href="#attr_ba_App__language">language</a>, <a href="#attr_ba_App__locale">locale</a>, <a href="#attr_ba_App__on_tv">on_tv</a>, <a href="#attr_ba_App__platform">platform</a>, <a href="#attr_ba_App__subplatform">subplatform</a>, <a href="#attr_ba_App__system_scripts_directory">system_scripts_directory</a>, <a href="#attr_ba_App__test_build">test_build</a>, <a href="#attr_ba_App__ui_bounds">ui_bounds</a>, <a href="#attr_ba_App__user_agent_string">user_agent_string</a>, <a href="#attr_ba_App__user_scripts_directory">user_scripts_directory</a>, <a href="#attr_ba_App__version">version</a>, <a href="#attr_ba_App__vr_mode">vr_mode</a></h5>
<dl>
<dt><h4><a name="attr_ba_App__api_version">api_version</a></h4></dt><dd>
<p><span>int</span></p>
<p>The game's api version.</p>
<p> Only python modules and packages associated with the current api
version will be detected by the game (see the ba_meta tag). This
value will change whenever backward-incompatible changes are
introduced to game apis; when that happens, scripts should be updated
accordingly and set to target the new api.</p>
</dd>
<dt><h4><a name="attr_ba_App__build_number">build_number</a></h4></dt><dd>
<p><span>int</span></p>
<p>Integer build number.</p>
<p> This value increases by at least 1 with each release of the game.
It is independent of the human readable <a href="#attr_ba_App__version">ba.App.version</a> string.</p>
</dd>
<dt><h4><a name="attr_ba_App__config">config</a></h4></dt><dd>
<p><span><a href="#class_ba_AppConfig">ba.AppConfig</a></span></p>
<p>The <a href="#class_ba_AppConfig">ba.AppConfig</a> instance representing the app's config state.</p>
</dd>
<dt><h4><a name="attr_ba_App__config_file_path">config_file_path</a></h4></dt><dd>
<p><span>str</span></p>
<p>Where the game's config file is stored on disk.</p>
</dd>
<dt><h4><a name="attr_ba_App__debug_build">debug_build</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether the game was compiled in debug mode.</p>
<p> Debug builds generally run substantially slower than non-debug
builds due to compiler optimizations being disabled and extra
checks being run.</p>
</dd>
<dt><h4><a name="attr_ba_App__interface_type">interface_type</a></h4></dt><dd>
<p><span>str</span></p>
<p>Interface mode the game is in; can be 'large', 'medium', or 'small'.</p>
<p> 'large' is used by system such as desktop PC where elements on screen
remain usable even at small sizes, allowing more to be shown.
'small' is used by small devices such as phones, where elements on
screen must be larger to remain readable and usable.
'medium' is used by tablets and other middle-of-the-road situations
such as VR or TV.</p>
</dd>
<dt><h4><a name="attr_ba_App__language">language</a></h4></dt><dd>
<p><span>str</span></p>
<p>The name of the language the game is running in.</p>
<p> This can be selected explicitly by the user or may be set
automatically based on <a href="#attr_ba_App__locale">ba.App.locale</a> or other factors.</p>
</dd>
<dt><h4><a name="attr_ba_App__locale">locale</a></h4></dt><dd>
<p><span>str</span></p>
<p>Raw country/language code detected by the game (such as 'en_US').</p>
<p> Generally for language-specific code you should look at
<a href="#attr_ba_App__language">ba.App.language</a>, which is the language the game is using
(which may differ from locale if the user sets a language, etc.)</p>
</dd>
<dt><h4><a name="attr_ba_App__on_tv">on_tv</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Bool value for if the game is running on a TV.</p>
</dd>
<dt><h4><a name="attr_ba_App__platform">platform</a></h4></dt><dd>
<p><span>str</span></p>
<p>Name of the current platform.</p>
<p> Examples are: 'mac', 'windows', android'.</p>
</dd>
<dt><h4><a name="attr_ba_App__subplatform">subplatform</a></h4></dt><dd>
<p><span>str</span></p>
<p>String for subplatform.</p>
<p> Can be empty. For the 'android' platform, subplatform may
be 'google', 'amazon', etc.</p>
</dd>
<dt><h4><a name="attr_ba_App__system_scripts_directory">system_scripts_directory</a></h4></dt><dd>
<p><span>str</span></p>
<p>Path where the game is looking for its bundled scripts.</p>
</dd>
<dt><h4><a name="attr_ba_App__test_build">test_build</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether the game was compiled in test mode.</p>
<p> Test mode enables extra checks and features that are useful for
release testing but which do not slow the game down significantly.</p>
</dd>
<dt><h4><a name="attr_ba_App__ui_bounds">ui_bounds</a></h4></dt><dd>
<p><span>Tuple[float, float, float, float]</span></p>
<p>Bounds of the 'safe' screen area in ui space.</p>
<p> This tuple contains: (x-min, x-max, y-min, y-max)</p>
</dd>
<dt><h4><a name="attr_ba_App__user_agent_string">user_agent_string</a></h4></dt><dd>
<p><span>str</span></p>
<p>String containing various bits of info about OS/device/etc.</p>
</dd>
<dt><h4><a name="attr_ba_App__user_scripts_directory">user_scripts_directory</a></h4></dt><dd>
<p><span>str</span></p>
<p>Path where the game is looking for custom user scripts.</p>
</dd>
<dt><h4><a name="attr_ba_App__version">version</a></h4></dt><dd>
<p><span>str</span></p>
<p>Human-readable version string; something like '1.3.24'.</p>
<p> This should not be interpreted as a number; it may contain
string elements such as 'alpha', 'beta', 'test', etc.
If a numeric version is needed, use '<a href="#attr_ba_App__build_number">ba.App.build_number</a>'.</p>
</dd>
<dt><h4><a name="attr_ba_App__vr_mode">vr_mode</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Bool value for if the game is running in VR.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_App__handle_app_pause">handle_app_pause()</a>, <a href="#method_ba_App__handle_app_resume">handle_app_resume()</a>, <a href="#method_ba_App__handle_deep_link">handle_deep_link()</a>, <a href="#method_ba_App__launch_coop_game">launch_coop_game()</a>, <a href="#method_ba_App__pause">pause()</a>, <a href="#method_ba_App__resume">resume()</a>, <a href="#method_ba_App__return_to_main_menu_session_gracefully">return_to_main_menu_session_gracefully()</a></h5>
<dl>
<dt><h4><a name="method_ba_App__handle_app_pause">handle_app_pause()</a></dt></h4><dd>
<p><span>handle_app_pause(self) -&gt; None</span></p>
<p>Called when the app goes to a suspended state.</p>
</dd>
<dt><h4><a name="method_ba_App__handle_app_resume">handle_app_resume()</a></dt></h4><dd>
<p><span>handle_app_resume(self) -&gt; None</span></p>
<p>Run when the app resumes from a suspended state.</p>
</dd>
<dt><h4><a name="method_ba_App__handle_deep_link">handle_deep_link()</a></dt></h4><dd>
<p><span>handle_deep_link(self, url: str) -&gt; None</span></p>
<p>Handle a deep link URL.</p>
</dd>
<dt><h4><a name="method_ba_App__launch_coop_game">launch_coop_game()</a></dt></h4><dd>
<p><span>launch_coop_game(self, game: str, force: bool = False, args: Dict = None) -&gt; bool</span></p>
<p>High level way to launch a co-op session locally.</p>
</dd>
<dt><h4><a name="method_ba_App__pause">pause()</a></dt></h4><dd>
<p><span>pause(self) -&gt; None</span></p>
<p>Pause the game due to a user request or menu popping up.</p>
<p>If there's a foreground host-activity that says it's pausable, tell it
to pause ..we now no longer pause if there are connected clients.</p>
</dd>
<dt><h4><a name="method_ba_App__resume">resume()</a></dt></h4><dd>
<p><span>resume(self) -&gt; None</span></p>
<p>Resume the game due to a user request or menu closing.</p>
<p>If there's a foreground host-activity that's currently paused, tell it
to resume.</p>
</dd>
<dt><h4><a name="method_ba_App__return_to_main_menu_session_gracefully">return_to_main_menu_session_gracefully()</a></dt></h4><dd>
<p><span>return_to_main_menu_session_gracefully(self) -&gt; None</span></p>
<p>Attempt to cleanly get back to the main menu.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_AppConfig">ba.AppConfig</a></strong></h3>
<p>inherits from: dict</p>
<p>A special dict that holds the game's persistent configuration values.</p>
<p>Category: <a href="#class_category_App_Classes">App Classes</a></p>
<p> It also provides methods for fetching values with app-defined fallback
defaults, applying contained values to the game, and committing the
config to storage.</p>
<p> Call ba.appconfig() to get the single shared instance of this class.</p>
<p> AppConfig data is stored as json on disk on so make sure to only place
json-friendly values in it (dict, list, str, float, int, bool).
Be aware that tuples will be quietly converted to lists.
</p>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_AppConfig__apply">apply()</a>, <a href="#method_ba_AppConfig__apply_and_commit">apply_and_commit()</a>, <a href="#method_ba_AppConfig__builtin_keys">builtin_keys()</a>, <a href="#method_ba_AppConfig__commit">commit()</a>, <a href="#method_ba_AppConfig__default_value">default_value()</a>, <a href="#method_ba_AppConfig__resolve">resolve()</a></h5>
<dl>
<dt><h4><a name="method_ba_AppConfig__apply">apply()</a></dt></h4><dd>
<p><span>apply(self) -&gt; None</span></p>
<p>Apply config values to the running app.</p>
</dd>
<dt><h4><a name="method_ba_AppConfig__apply_and_commit">apply_and_commit()</a></dt></h4><dd>
<p><span>apply_and_commit(self) -&gt; None</span></p>
<p>Run apply() followed by commit(); for convenience.</p>
<p>(This way the commit() will not occur if apply() hits invalid data)</p>
</dd>
<dt><h4><a name="method_ba_AppConfig__builtin_keys">builtin_keys()</a></dt></h4><dd>
<p><span>builtin_keys(self) -&gt; List[str]</span></p>
<p>Return the list of valid key names recognized by <a href="#class_ba_AppConfig">ba.AppConfig</a>.</p>
<p>This set of keys can be used with resolve(), default_value(), etc.
It does not vary across platforms and may include keys that are
obsolete or not relevant on the current running version. (for instance,
VR related keys on non-VR platforms). This is to minimize the amount
of platform checking necessary)</p>
<p>Note that it is perfectly legal to store arbitrary named data in the
config, but in that case it is up to the user to test for the existence
of the key in the config dict, fall back to consistent defaults, etc.</p>
</dd>
<dt><h4><a name="method_ba_AppConfig__commit">commit()</a></dt></h4><dd>
<p><span>commit(self) -&gt; None</span></p>
<p>Commits the config to local storage.</p>
<p>Note that this call is asynchronous so the actual write to disk may not
occur immediately.</p>
</dd>
<dt><h4><a name="method_ba_AppConfig__default_value">default_value()</a></dt></h4><dd>
<p><span>default_value(self, key: str) -&gt; Any</span></p>
<p>Given a string key, return its predefined default value.</p>
<p>This is the value that will be returned by <a href="#method_ba_AppConfig__resolve">ba.AppConfig.resolve</a>() if
the key is not present in the config dict or of an incompatible type.</p>
<p>Raises an Exception for unrecognized key names. To get the list of keys
supported by this method, use <a href="#method_ba_AppConfig__builtin_keys">ba.AppConfig.builtin_keys</a>(). Note that it
is perfectly legal to store other data in the config; it just needs to
be accessed through standard dict methods and missing values handled
manually.</p>
</dd>
<dt><h4><a name="method_ba_AppConfig__resolve">resolve()</a></dt></h4><dd>
<p><span>resolve(self, key: str) -&gt; Any</span></p>
<p>Given a string key, return a config value (type varies).</p>
<p>This will substitute application defaults for values not present in
the config dict, filter some invalid values, etc. Note that these
values do not represent the state of the app; simply the state of its
config. Use <a href="#class_ba_App">ba.App</a> to access actual live state.</p>
<p>Raises an Exception for unrecognized key names. To get the list of keys
supported by this method, use <a href="#method_ba_AppConfig__builtin_keys">ba.AppConfig.builtin_keys</a>(). Note that it
is perfectly legal to store other data in the config; it just needs to
be accessed through standard dict methods and missing values handled
manually.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_AppDelegate">ba.AppDelegate</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Defines handlers for high level app functionality.</p>
<p>Category: <a href="#class_category_App_Classes">App Classes</a>
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_AppDelegate__create_default_game_config_ui">create_default_game_config_ui()</a></dt></h4><dd>
<p><span>create_default_game_config_ui(self, gameclass: Type[<a href="#class_ba_GameActivity">ba.GameActivity</a>], sessionclass: Type[<a href="#class_ba_Session">ba.Session</a>], config: Optional[Dict[str, Any]], completion_call: Callable[[Optional[Dict[str, Any]]], None]) -&gt; None</span></p>
<p>Launch a UI to configure the given game config.</p>
<p>It should manipulate the contents of config and call completion_call
when done.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_AssetPackage">ba.AssetPackage</a></strong></h3>
<p>inherits from: <a href="#class_ba_DependencyComponent">ba.DependencyComponent</a></p>
<p><a href="#class_ba_DependencyComponent">ba.DependencyComponent</a> representing a bundled package of game assets.</p>
<p>Category: <a href="#class_category_Asset_Classes">Asset Classes</a>
</p>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_DependencyComponent__get_dynamic_deps">get_dynamic_deps()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_AssetPackage____init__">&lt;constructor&gt;</a>, <a href="#method_ba_AssetPackage__dep_is_present">dep_is_present()</a>, <a href="#method_ba_AssetPackage__getcollidemodel">getcollidemodel()</a>, <a href="#method_ba_AssetPackage__getdata">getdata()</a>, <a href="#method_ba_AssetPackage__getmodel">getmodel()</a>, <a href="#method_ba_AssetPackage__getsound">getsound()</a>, <a href="#method_ba_AssetPackage__gettexture">gettexture()</a></h5>
<dl>
<dt><h4><a name="method_ba_AssetPackage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.AssetPackage()</span></p>
<p>Instantiate a DependencyComponent.</p>
</dd>
<dt><h4><a name="method_ba_AssetPackage__dep_is_present">dep_is_present()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>dep_is_present(config: Any = None) -&gt; bool </span></p>
<p>Return whether this component/config is present on this device.</p>
</dd>
<dt><h4><a name="method_ba_AssetPackage__getcollidemodel">getcollidemodel()</a></dt></h4><dd>
<p><span>getcollidemodel(self, name: str) -&gt; <a href="#class_ba_CollideModel">ba.CollideModel</a></span></p>
<p>Load a named <a href="#class_ba_CollideModel">ba.CollideModel</a> from the AssetPackage.</p>
<p>Behavior is similar to ba.getcollideModel()</p>
</dd>
<dt><h4><a name="method_ba_AssetPackage__getdata">getdata()</a></dt></h4><dd>
<p><span>getdata(self, name: str) -&gt; <a href="#class_ba_Data">ba.Data</a></span></p>
<p>Load a named <a href="#class_ba_Data">ba.Data</a> from the AssetPackage.</p>
<p>Behavior is similar to ba.getdata()</p>
</dd>
<dt><h4><a name="method_ba_AssetPackage__getmodel">getmodel()</a></dt></h4><dd>
<p><span>getmodel(self, name: str) -&gt; <a href="#class_ba_Model">ba.Model</a></span></p>
<p>Load a named <a href="#class_ba_Model">ba.Model</a> from the AssetPackage.</p>
<p>Behavior is similar to <a href="#function_ba_getmodel">ba.getmodel</a>()</p>
</dd>
<dt><h4><a name="method_ba_AssetPackage__getsound">getsound()</a></dt></h4><dd>
<p><span>getsound(self, name: str) -&gt; <a href="#class_ba_Sound">ba.Sound</a></span></p>
<p>Load a named <a href="#class_ba_Sound">ba.Sound</a> from the AssetPackage.</p>
<p>Behavior is similar to <a href="#function_ba_getsound">ba.getsound</a>()</p>
</dd>
<dt><h4><a name="method_ba_AssetPackage__gettexture">gettexture()</a></dt></h4><dd>
<p><span>gettexture(self, name: str) -&gt; <a href="#class_ba_Texture">ba.Texture</a></span></p>
<p>Load a named <a href="#class_ba_Texture">ba.Texture</a> from the AssetPackage.</p>
<p>Behavior is similar to <a href="#function_ba_gettexture">ba.gettexture</a>()</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Call">ba.Call</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Wraps a callable and arguments into a single callable object.</p>
<p>Category: <a href="#class_category_General_Utility_Classes">General Utility Classes</a></p>
<p> The callable is strong-referenced so it won't die until this
object does.</p>
<p> Note that a bound method (ex: myobj.dosomething) contains a reference
to 'self' (myobj in that case), so you will be keeping that object
alive too. Use <a href="#class_ba_WeakCall">ba.WeakCall</a> if you want to pass a method to callback
without keeping its object alive.
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_Call____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Call(*args: Any, **keywds: Any)</span></p>
<p>Instantiate a Call; pass a callable as the first
arg, followed by any number of arguments or keywords.</p>
<pre><span><em><small># Example: wrap a method call with 1 positional and 1 keyword arg:</small></em></span>
mycall = ba.Call(myobj.dostuff, argval1, namedarg=argval2)</pre>
<pre><span><em><small># Now we have a single callable to run that whole mess.</small></em></span>
<span><em><small># ..the same as calling myobj.dostuff(argval1, namedarg=argval2)</small></em></span>
mycall()</pre>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Campaign">ba.Campaign</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Represents a unique set or series of <a href="#class_ba_Level">ba.Levels</a>.</p>
<p>Category: <a href="#class_category_App_Classes">App Classes</a>
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Campaign__name">name</a>, <a href="#attr_ba_Campaign__sequential">sequential</a></h5>
<dl>
<dt><h4><a name="attr_ba_Campaign__name">name</a></h4></dt><dd>
<p><span>str</span></p>
<p>The name of the Campaign.</p>
</dd>
<dt><h4><a name="attr_ba_Campaign__sequential">sequential</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether this Campaign's levels must be played in sequence.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Campaign____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Campaign__add_level">add_level()</a>, <a href="#method_ba_Campaign__get_config_dict">get_config_dict()</a>, <a href="#method_ba_Campaign__get_level">get_level()</a>, <a href="#method_ba_Campaign__get_levels">get_levels()</a>, <a href="#method_ba_Campaign__get_selected_level">get_selected_level()</a>, <a href="#method_ba_Campaign__reset">reset()</a>, <a href="#method_ba_Campaign__set_selected_level">set_selected_level()</a></h5>
<dl>
<dt><h4><a name="method_ba_Campaign____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Campaign(name: str, sequential: bool = True)</span></p>
</dd>
<dt><h4><a name="method_ba_Campaign__add_level">add_level()</a></dt></h4><dd>
<p><span>add_level(self, level: <a href="#class_ba_Level">ba.Level</a>) -&gt; None</span></p>
<p>Adds a <a href="#class_ba_Level">ba.Level</a> to the Campaign.</p>
</dd>
<dt><h4><a name="method_ba_Campaign__get_config_dict">get_config_dict()</a></dt></h4><dd>
<p><span>get_config_dict(self) -&gt; Dict[str, Any]</span></p>
<p>Return the live config dict for this campaign.</p>
</dd>
<dt><h4><a name="method_ba_Campaign__get_level">get_level()</a></dt></h4><dd>
<p><span>get_level(self, name: str) -&gt; <a href="#class_ba_Level">ba.Level</a></span></p>
<p>Return a contained <a href="#class_ba_Level">ba.Level</a> by name.</p>
</dd>
<dt><h4><a name="method_ba_Campaign__get_levels">get_levels()</a></dt></h4><dd>
<p><span>get_levels(self) -&gt; List[<a href="#class_ba_Level">ba.Level</a>]</span></p>
<p>Return the set of <a href="#class_ba_Level">ba.Levels</a> in the Campaign.</p>
</dd>
<dt><h4><a name="method_ba_Campaign__get_selected_level">get_selected_level()</a></dt></h4><dd>
<p><span>get_selected_level(self) -&gt; str</span></p>
<p>Return the name of the Level currently selected in the UI.</p>
</dd>
<dt><h4><a name="method_ba_Campaign__reset">reset()</a></dt></h4><dd>
<p><span>reset(self) -&gt; None</span></p>
<p>Reset state for the Campaign.</p>
</dd>
<dt><h4><a name="method_ba_Campaign__set_selected_level">set_selected_level()</a></dt></h4><dd>
<p><span>set_selected_level(self, levelname: str) -&gt; None</span></p>
<p>Set the Level currently selected in the UI (by name).</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_CelebrateMessage">ba.CelebrateMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object to celebrate.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_CelebrateMessage__duration">duration</a></h4></dt><dd>
<p><span>float</span></p>
<p>Amount of time to celebrate in seconds.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_CelebrateMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.CelebrateMessage(duration: float = 10.0)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Chooser">ba.Chooser</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A character/team selector for a <a href="#class_ba_Player">ba.Player</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Chooser__lobby">lobby</a>, <a href="#attr_ba_Chooser__player">player</a>, <a href="#attr_ba_Chooser__ready">ready</a></h5>
<dl>
<dt><h4><a name="attr_ba_Chooser__lobby">lobby</a></h4></dt><dd>
<p><span><a href="#class_ba_Lobby">ba.Lobby</a></span></p>
<p>The chooser's <a href="#class_ba_Lobby">ba.Lobby</a>.</p>
</dd>
<dt><h4><a name="attr_ba_Chooser__player">player</a></h4></dt><dd>
<p><span><a href="#class_ba_Player">ba.Player</a></span></p>
<p>The <a href="#class_ba_Player">ba.Player</a> associated with this chooser.</p>
</dd>
<dt><h4><a name="attr_ba_Chooser__ready">ready</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether this chooser is checked in as ready.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Chooser____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Chooser__get_character_name">get_character_name()</a>, <a href="#method_ba_Chooser__get_color">get_color()</a>, <a href="#method_ba_Chooser__get_highlight">get_highlight()</a>, <a href="#method_ba_Chooser__get_lobby">get_lobby()</a>, <a href="#method_ba_Chooser__get_team">get_team()</a>, <a href="#method_ba_Chooser__getplayer">getplayer()</a>, <a href="#method_ba_Chooser__handlemessage">handlemessage()</a>, <a href="#method_ba_Chooser__reload_profiles">reload_profiles()</a>, <a href="#method_ba_Chooser__update_from_player_profiles">update_from_player_profiles()</a>, <a href="#method_ba_Chooser__update_position">update_position()</a></h5>
<dl>
<dt><h4><a name="method_ba_Chooser____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Chooser(vpos: float, player: _<a href="#class_ba_Player">ba.Player</a>, lobby: "Lobby")</span></p>
</dd>
<dt><h4><a name="method_ba_Chooser__get_character_name">get_character_name()</a></dt></h4><dd>
<p><span>get_character_name(self) -&gt; str</span></p>
<p>Return the selected character name.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__get_color">get_color()</a></dt></h4><dd>
<p><span>get_color(self) -&gt; Sequence[float]</span></p>
<p>Return the currently selected color.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__get_highlight">get_highlight()</a></dt></h4><dd>
<p><span>get_highlight(self) -&gt; Sequence[float]</span></p>
<p>Return the currently selected highlight.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__get_lobby">get_lobby()</a></dt></h4><dd>
<p><span>get_lobby(self) -&gt; Optional[<a href="#class_ba_Lobby">ba.Lobby</a>]</span></p>
<p>Return this chooser's lobby if it still exists; otherwise None.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__get_team">get_team()</a></dt></h4><dd>
<p><span>get_team(self) -&gt; <a href="#class_ba_Team">ba.Team</a></span></p>
<p>Return this chooser's selected <a href="#class_ba_Team">ba.Team</a>.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__getplayer">getplayer()</a></dt></h4><dd>
<p><span>getplayer(self) -&gt; <a href="#class_ba_Player">ba.Player</a></span></p>
<p>Return the player associated with this chooser.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(self, msg: Any) -&gt; Any</span></p>
<p>Standard generic message handler.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__reload_profiles">reload_profiles()</a></dt></h4><dd>
<p><span>reload_profiles(self) -&gt; None</span></p>
<p>Reload all player profiles.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__update_from_player_profiles">update_from_player_profiles()</a></dt></h4><dd>
<p><span>update_from_player_profiles(self) -&gt; None</span></p>
<p>Set character based on profile; otherwise use pre-picked random.</p>
</dd>
<dt><h4><a name="method_ba_Chooser__update_position">update_position()</a></dt></h4><dd>
<p><span>update_position(self) -&gt; None</span></p>
<p>Update this chooser's position.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_CollideModel">ba.CollideModel</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A reference to a collide-model.</p>
<p>Category: <a href="#class_category_Asset_Classes">Asset Classes</a></p>
<p>Use <a href="#function_ba_getcollidemodel">ba.getcollidemodel</a>() to instantiate one.</p>
<hr>
<h2><strong><a name="class_ba_Context">ba.Context</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Context(source: Any)</p>
<p>A game context state.</p>
<p>Category: <a href="#class_category_General_Utility_Classes">General Utility Classes</a></p>
<p>Many operations such as <a href="#function_ba_newnode">ba.newnode</a>() or <a href="#function_ba_gettexture">ba.gettexture</a>() operate
implicitly on the current context. Each <a href="#class_ba_Activity">ba.Activity</a> has its own
Context and objects within that activity (nodes, media, etc) can only
interact with other objects from that context.</p>
<p>In general, as a modder, you should not need to worry about contexts,
since timers and other callbacks will take care of saving and
restoring the context automatically, but there may be rare cases where
you need to deal with them, such as when loading media in for use in
the UI (there is a special 'ui' context for all user-interface-related
functionality)</p>
<p>When instantiating a <a href="#class_ba_Context">ba.Context</a> instance, a single 'source' argument
is passed, which can be one of the following strings/objects:</p>
<p>'empty':
Gives an empty context; it can be handy to run code here to ensure
it does no loading of media, creation of nodes, etc.</p>
<p>'current':
Sets the context object to the current context.</p>
<p>'ui':
Sets to the UI context. UI functions as well as loading of media to
be used in said functions must happen in the UI context.</p>
<p>a <a href="#class_ba_Activity">ba.Activity</a> instance:
Gives the context for the provided <a href="#class_ba_Activity">ba.Activity</a>.
Most all code run during a game happens in an Activity's Context.</p>
<p>a <a href="#class_ba_Session">ba.Session</a> instance:
Gives the context for the provided <a href="#class_ba_Session">ba.Session</a>.
Generally a user should not need to run anything here.</p>
<p><strong>
Usage:</strong></p>
<p>Contexts are generally used with the python 'with' statement, which
sets the context as current on entry and resets it to the previous
value on exit.</p>
<pre><span><em><small># Example: load a few textures into the UI context</small></em></span>
<span><em><small># (for use in widgets, etc):</small></em></span>
with <a href="#class_ba_Context">ba.Context</a>('ui'):
tex1 = <a href="#function_ba_gettexture">ba.gettexture</a>('foo_tex_1')
tex2 = <a href="#function_ba_gettexture">ba.gettexture</a>('foo_tex_2')</pre>
<hr>
<h2><strong><a name="class_ba_ContextCall">ba.ContextCall</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>ContextCall(call: Callable)</p>
<p>A context-preserving callable.</p>
<p>Category: <a href="#class_category_General_Utility_Classes">General Utility Classes</a></p>
<p>A ContextCall wraps a callable object along with a reference
to the current context (see <a href="#class_ba_Context">ba.Context</a>); it handles restoring the
context when run and automatically clears itself if the context
it belongs to shuts down.</p>
<p>Generally you should not need to use this directly; all standard
Ballistica callbacks involved with timers, materials, UI functions,
etc. handle this under-the-hood you don't have to worry about it.
The only time it may be necessary is if you are implementing your
own callbacks, such as a worker thread that does some action and then
runs some game code when done. By wrapping said callback in one of
these, you can ensure that you will not inadvertently be keeping the
current activity alive or running code in a torn-down (expired)
context.</p>
<p>You can also use <a href="#class_ba_WeakCall">ba.WeakCall</a> for similar functionality, but
ContextCall has the added bonus that it will not run during context
shutdown, whereas <a href="#class_ba_WeakCall">ba.WeakCall</a> simply looks at whether the target
object still exists.</p>
<pre><span><em><small># example A: code like this can inadvertently prevent our activity</small></em></span>
<span><em><small># (self) from ending until the operation completes, since the bound</small></em></span>
<span><em><small># method we're passing (self.dosomething) contains a strong-reference</small></em></span>
<span><em><small># to self).</small></em></span>
start_some_long_action(callback_when_done=self.dosomething)</pre>
<pre><span><em><small># example B: in this case our activity (self) can still die</small></em></span>
<span><em><small># properly; the callback will clear itself when the activity starts</small></em></span>
<span><em><small># shutting down, becoming a harmless no-op and releasing the reference</small></em></span>
<span><em><small># to our activity.</small></em></span>
start_long_action(callback_when_done=<a href="#class_ba_ContextCall">ba.ContextCall</a>(self.mycallback))</pre>
<hr>
<h2><strong><a name="class_ba_CoopGameActivity">ba.CoopGameActivity</a></strong></h3>
<p>inherits from: <a href="#class_ba_GameActivity">ba.GameActivity</a>, <a href="#class_ba_Activity">ba.Activity</a>, <a href="#class_ba_DependencyComponent">ba.DependencyComponent</a></p>
<p>Base class for cooperative-mode games.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Activity__players">players</a>, <a href="#attr_ba_Activity__settings">settings</a>, <a href="#attr_ba_Activity__teams">teams</a></h5>
<h3>Attributes Defined Here:</h3>
<h5><a href="#attr_ba_CoopGameActivity__map">map</a>, <a href="#attr_ba_CoopGameActivity__session">session</a>, <a href="#attr_ba_CoopGameActivity__stats">stats</a></h5>
<dl>
<dt><h4><a name="attr_ba_CoopGameActivity__map">map</a></h4></dt><dd>
<p><span><a href="#class_ba_Map">ba.Map</a></span></p>
<p>The map being used for this game.</p>
<p> Raises a <a href="#class_ba_NotFoundError">ba.NotFoundError</a> if the map does not currently exist.</p>
</dd>
<dt><h4><a name="attr_ba_CoopGameActivity__session">session</a></h4></dt><dd>
<p><span><a href="#class_ba_Session">ba.Session</a></span></p>
<p>The <a href="#class_ba_Session">ba.Session</a> this <a href="#class_ba_Activity">ba.Activity</a> belongs go.</p>
<p> Raises a <a href="#class_ba_SessionNotFoundError">ba.SessionNotFoundError</a> if the Session no longer exists.</p>
</dd>
<dt><h4><a name="attr_ba_CoopGameActivity__stats">stats</a></h4></dt><dd>
<p><span><a href="#class_ba_Stats">ba.Stats</a></span></p>
<p>The stats instance accessible while the activity is running.</p>
<p> If access is attempted before or after, raises a <a href="#class_ba_NotFoundError">ba.NotFoundError</a>.</p>
</dd>
</dl>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_GameActivity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_GameActivity__begin">begin()</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__create_player_node">create_player_node()</a>, <a href="#method_ba_GameActivity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_GameActivity__end">end()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_resolved_score_info">get_resolved_score_info()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_settings">get_settings()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__has_begun">has_begun()</a>, <a href="#method_ba_GameActivity__has_ended">has_ended()</a>, <a href="#method_ba_GameActivity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_GameActivity__is_expired">is_expired()</a>, <a href="#method_ba_GameActivity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_expire">on_expire()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_team_join">on_team_join()</a>, <a href="#method_ba_GameActivity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_GameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_GameActivity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__retain_actor">retain_actor()</a>, <a href="#method_ba_GameActivity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_GameActivity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__start_transition_in">start_transition_in()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_CoopGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_CoopGameActivity__celebrate">celebrate()</a>, <a href="#method_ba_CoopGameActivity__fade_to_red">fade_to_red()</a>, <a href="#method_ba_CoopGameActivity__get_score_type">get_score_type()</a>, <a href="#method_ba_CoopGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_CoopGameActivity__setup_low_life_warning_sound">setup_low_life_warning_sound()</a>, <a href="#method_ba_CoopGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_CoopGameActivity__supports_session_type">supports_session_type()</a></h5>
<dl>
<dt><h4><a name="method_ba_CoopGameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.CoopGameActivity(settings: Dict[str, Any])</span></p>
<p>Instantiate the Activity.</p>
</dd>
<dt><h4><a name="method_ba_CoopGameActivity__celebrate">celebrate()</a></dt></h4><dd>
<p><span>celebrate(self, duration: float) -&gt; None</span></p>
<p>Tells all existing player-controlled characters to celebrate.</p>
<p>Can be useful in co-op games when the good guys score or complete
a wave.
duration is given in seconds.</p>
</dd>
<dt><h4><a name="method_ba_CoopGameActivity__fade_to_red">fade_to_red()</a></dt></h4><dd>
<p><span>fade_to_red(self) -&gt; None</span></p>
<p>Fade the screen to red; (such as when the good guys have lost).</p>
</dd>
<dt><h4><a name="method_ba_CoopGameActivity__get_score_type">get_score_type()</a></dt></h4><dd>
<p><span>get_score_type(self) -&gt; str</span></p>
<p>Return the score unit this co-op game uses ('point', 'seconds', etc.)</p>
</dd>
<dt><h4><a name="method_ba_CoopGameActivity__on_begin">on_begin()</a></dt></h4><dd>
<p><span>on_begin(self) -&gt; None</span></p>
<p>Called once the previous <a href="#class_ba_Activity">ba.Activity</a> has finished transitioning out.</p>
<p>At this point the activity's initial players and teams are filled in
and it should begin its actual game logic.</p>
</dd>
<dt><h4><a name="method_ba_CoopGameActivity__setup_low_life_warning_sound">setup_low_life_warning_sound()</a></dt></h4><dd>
<p><span>setup_low_life_warning_sound(self) -&gt; None</span></p>
<p>Set up a beeping noise to play when any players are near death.</p>
</dd>
<dt><h4><a name="method_ba_CoopGameActivity__spawn_player_spaz">spawn_player_spaz()</a></dt></h4><dd>
<p><span>spawn_player_spaz(self, player: <a href="#class_ba_Player">ba.Player</a>, position: Sequence[float] = (0.0, 0.0, 0.0), angle: float = None) -&gt; PlayerSpaz</span></p>
<p>Spawn and wire up a standard player spaz.</p>
</dd>
<dt><h4><a name="method_ba_CoopGameActivity__supports_session_type">supports_session_type()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>supports_session_type(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; bool </span></p>
<p>Return whether this game supports the provided Session type.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_CoopSession">ba.CoopSession</a></strong></h3>
<p>inherits from: <a href="#class_ba_Session">ba.Session</a></p>
<p>A <a href="#class_ba_Session">ba.Session</a> which runs cooperative-mode games.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> These generally consist of 1-4 players against
the computer and include functionality such as
high score lists.
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Session__campaign">campaign</a>, <a href="#attr_ba_Session__lobby">lobby</a>, <a href="#attr_ba_Session__max_players">max_players</a>, <a href="#attr_ba_Session__min_players">min_players</a>, <a href="#attr_ba_Session__players">players</a>, <a href="#attr_ba_Session__teams">teams</a></h5>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_Session__begin_next_activity">begin_next_activity()</a>, <a href="#method_ba_Session__end">end()</a>, <a href="#method_ba_Session__end_activity">end_activity()</a>, <a href="#method_ba_Session__getactivity">getactivity()</a>, <a href="#method_ba_Session__handlemessage">handlemessage()</a>, <a href="#method_ba_Session__launch_end_session_activity">launch_end_session_activity()</a>, <a href="#method_ba_Session__on_player_request">on_player_request()</a>, <a href="#method_ba_Session__on_team_join">on_team_join()</a>, <a href="#method_ba_Session__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Session__set_activity">set_activity()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_CoopSession____init__">&lt;constructor&gt;</a>, <a href="#method_ba_CoopSession__get_current_game_instance">get_current_game_instance()</a>, <a href="#method_ba_CoopSession__get_custom_menu_entries">get_custom_menu_entries()</a>, <a href="#method_ba_CoopSession__on_activity_end">on_activity_end()</a>, <a href="#method_ba_CoopSession__on_player_leave">on_player_leave()</a>, <a href="#method_ba_CoopSession__restart">restart()</a></h5>
<dl>
<dt><h4><a name="method_ba_CoopSession____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.CoopSession()</span></p>
<p>Instantiate a co-op mode session.</p>
</dd>
<dt><h4><a name="method_ba_CoopSession__get_current_game_instance">get_current_game_instance()</a></dt></h4><dd>
<p><span>get_current_game_instance(self) -&gt; <a href="#class_ba_GameActivity">ba.GameActivity</a></span></p>
<p>Get the game instance currently being played.</p>
</dd>
<dt><h4><a name="method_ba_CoopSession__get_custom_menu_entries">get_custom_menu_entries()</a></dt></h4><dd>
<p><span>get_custom_menu_entries(self) -&gt; List[Dict[str, Any]]</span></p>
<p>Subclasses can override this to provide custom menu entries.</p>
<p>The returned value should be a list of dicts, each containing
a 'label' and 'call' entry, with 'label' being the text for
the entry and 'call' being the callable to trigger if the entry
is pressed.</p>
</dd>
<dt><h4><a name="method_ba_CoopSession__on_activity_end">on_activity_end()</a></dt></h4><dd>
<p><span>on_activity_end(self, activity: <a href="#class_ba_Activity">ba.Activity</a>, results: Any) -&gt; None</span></p>
<p>Method override for co-op sessions.</p>
<p>Jumps between co-op games and score screens.</p>
</dd>
<dt><h4><a name="method_ba_CoopSession__on_player_leave">on_player_leave()</a></dt></h4><dd>
<p><span>on_player_leave(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Called when a previously-accepted <a href="#class_ba_Player">ba.Player</a> leaves the session.</p>
</dd>
<dt><h4><a name="method_ba_CoopSession__restart">restart()</a></dt></h4><dd>
<p><span>restart(self) -&gt; None</span></p>
<p>Restart the current game activity.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Data">ba.Data</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A reference to a data object.</p>
<p>Category: <a href="#class_category_Asset_Classes">Asset Classes</a></p>
<p>Use ba.getdata() to instantiate one.</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_Data__getvalue">getvalue()</a></dt></h4><dd>
<p><span>getvalue() -&gt; Any</span></p>
<p>Return the data object's value.</p>
<p>This can consist of anything representable by json (dicts, lists,
numbers, bools, None, etc).
Note that this call will block if the data has not yet been loaded,
so it can be beneficial to plan a short bit of time between when
the data object is requested and when it's value is accessed.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_DeathType">ba.DeathType</a></strong></h3>
<p>inherits from: enum.Enum</p>
<p>A reason for a death.</p>
<p>Category: <a href="#class_category_Enums">Enums</a>
</p>
<h3>Values:</h3>
<ul>
<li>GENERIC</li>
<li>OUT_OF_BOUNDS</li>
<li>IMPACT</li>
<li>FALL</li>
<li>REACHED_GOAL</li>
<li>LEFT_GAME</li>
</ul>
<hr>
<h2><strong><a name="class_ba_Dependency">ba.Dependency</a></strong></h3>
<p>inherits from: <a href="#class_typing_Generic">typing.Generic</a></p>
<p>A dependency on a DependencyComponent (with an optional config).</p>
<p>Category: <a href="#class_category_Dependency_Classes">Dependency Classes</a></p>
<p> This class is used to request and access functionality provided
by other DependencyComponent classes from a DependencyComponent class.
The class functions as a descriptor, allowing dependencies to
be added at a class level much the same as properties or methods
and then used with class instances to access those dependencies.
For instance, if you do 'floofcls = <a href="#class_ba_Dependency">ba.Dependency</a>(FloofClass)' you
would then be able to instantiate a FloofClass in your class's
methods via self.floofcls().
</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_Dependency____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Dependency__get_hash">get_hash()</a></h5>
<dl>
<dt><h4><a name="method_ba_Dependency____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Dependency(cls: Type[T], config: Any = None)</span></p>
<p>Instantiate a Dependency given a <a href="#class_ba_DependencyComponent">ba.DependencyComponent</a> type.</p>
<p>Optionally, an arbitrary object can be passed as 'config' to
influence dependency calculation for the target class.</p>
</dd>
<dt><h4><a name="method_ba_Dependency__get_hash">get_hash()</a></dt></h4><dd>
<p><span>get_hash(self) -&gt; int</span></p>
<p>Return the dependency's hash, calculating it if necessary.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_DependencyComponent">ba.DependencyComponent</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Base class for all classes that can act as or use dependencies.</p>
<p>Category: <a href="#class_category_Dependency_Classes">Dependency Classes</a>
</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_DependencyComponent____init__">&lt;constructor&gt;</a>, <a href="#method_ba_DependencyComponent__dep_is_present">dep_is_present()</a>, <a href="#method_ba_DependencyComponent__get_dynamic_deps">get_dynamic_deps()</a></h5>
<dl>
<dt><h4><a name="method_ba_DependencyComponent____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.DependencyComponent()</span></p>
<p>Instantiate a DependencyComponent.</p>
</dd>
<dt><h4><a name="method_ba_DependencyComponent__dep_is_present">dep_is_present()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>dep_is_present(config: Any = None) -&gt; bool </span></p>
<p>Return whether this component/config is present on this device.</p>
</dd>
<dt><h4><a name="method_ba_DependencyComponent__get_dynamic_deps">get_dynamic_deps()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_dynamic_deps(config: Any = None) -&gt; List[Dependency] </span></p>
<p>Return any dynamically-calculated deps for this component/config.</p>
<p>Deps declared statically as part of the class do not need to be
included here; this is only for additional deps that may vary based
on the dep config value. (for instance a map required by a game type)</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_DependencyError">ba.DependencyError</a></strong></h3>
<p>inherits from: Exception, BaseException</p>
<p>Exception raised when one or more <a href="#class_ba_Dependency">ba.Dependency</a> items are missing.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a></p>
<p> (this will generally be missing assets).
</p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_DependencyError__deps">deps</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_Dependency">ba.Dependency</a>]</span></p>
<p>The list of missing dependencies causing this error.</p>
</dd>
</dl>
<h3>Methods Inherited:</h3>
<h5><a href="#method_builtins_Exception__with_traceback">with_traceback()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<dl>
<dt><h4><a name="method_ba_DependencyError____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.DependencyError(deps: List[<a href="#class_ba_Dependency">ba.Dependency</a>])</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_DependencySet">ba.DependencySet</a></strong></h3>
<p>inherits from: <a href="#class_typing_Generic">typing.Generic</a></p>
<p>Set of resolved dependencies and their associated data.</p>
<p>Category: <a href="#class_category_Dependency_Classes">Dependency Classes</a></p>
<p> To use DependencyComponents, a set must be created, resolved, and then
loaded. The DependencyComponents are only valid while the set remains
in existence.
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_DependencySet__resolved">resolved</a>, <a href="#attr_ba_DependencySet__root">root</a></h5>
<dl>
<dt><h4><a name="attr_ba_DependencySet__resolved">resolved</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether this set has been successfully resolved.</p>
</dd>
<dt><h4><a name="attr_ba_DependencySet__root">root</a></h4></dt><dd>
<p><span>T</span></p>
<p>The instantiated root DependencyComponent instance for the set.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_DependencySet____init__">&lt;constructor&gt;</a>, <a href="#method_ba_DependencySet__get_asset_package_ids">get_asset_package_ids()</a>, <a href="#method_ba_DependencySet__load">load()</a>, <a href="#method_ba_DependencySet__resolve">resolve()</a></h5>
<dl>
<dt><h4><a name="method_ba_DependencySet____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.DependencySet(root_dependency: Dependency[T])</span></p>
</dd>
<dt><h4><a name="method_ba_DependencySet__get_asset_package_ids">get_asset_package_ids()</a></dt></h4><dd>
<p><span>get_asset_package_ids(self) -&gt; Set[str]</span></p>
<p>Return the set of asset-package-ids required by this dep-set.</p>
<p>Must be called on a resolved dep-set.</p>
</dd>
<dt><h4><a name="method_ba_DependencySet__load">load()</a></dt></h4><dd>
<p><span>load(self) -&gt; None</span></p>
<p>Instantiate all DependencyComponents in the set.</p>
<p>Returns a wrapper which can be used to instantiate the root dep.</p>
</dd>
<dt><h4><a name="method_ba_DependencySet__resolve">resolve()</a></dt></h4><dd>
<p><span>resolve(self) -&gt; None</span></p>
<p>Resolve the complete set of required dependencies for this set.</p>
<p>Raises a <a href="#class_ba_DependencyError">ba.DependencyError</a> if dependencies are missing (or other
Exception types on other errors).</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_DieMessage">ba.DieMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A message telling an object to die.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<p> Most <a href="#class_ba_Actor">ba.Actors</a> respond to this.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_DieMessage__how">how</a>, <a href="#attr_ba_DieMessage__immediate">immediate</a></h5>
<dl>
<dt><h4><a name="attr_ba_DieMessage__how">how</a></h4></dt><dd>
<p><span>DeathType</span></p>
<p>The particular reason for death.</p>
</dd>
<dt><h4><a name="attr_ba_DieMessage__immediate">immediate</a></h4></dt><dd>
<p><span>bool</span></p>
<p>If this is set to True, the actor should disappear immediately.
This is for 'removing' stuff from the game more so than 'killing'
it. If False, the actor should die a 'normal' death and can take
its time with lingering corpses, sound effects, etc.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_DieMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.DieMessage(immediate: bool = False, how: DeathType = &lt;DeathType.GENERIC: generic&gt;)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_DropMessage">ba.DropMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object that it has dropped what it was holding.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a>
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_DropMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.DropMessage()</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_DroppedMessage">ba.DroppedMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object that it has been dropped.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_DroppedMessage__node">node</a></h4></dt><dd>
<p><span><a href="#class_ba_Node">ba.Node</a></span></p>
<p>The <a href="#class_ba_Node">ba.Node</a> doing the dropping.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_DroppedMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.DroppedMessage(node: <a href="#class_ba_Node">ba.Node</a>)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_FreeForAllSession">ba.FreeForAllSession</a></strong></h3>
<p>inherits from: <a href="#class_ba_TeamBaseSession">ba.TeamBaseSession</a>, <a href="#class_ba_Session">ba.Session</a></p>
<p><a href="#class_ba_Session">ba.Session</a> type for free-for-all mode games.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Session__campaign">campaign</a>, <a href="#attr_ba_Session__lobby">lobby</a>, <a href="#attr_ba_Session__max_players">max_players</a>, <a href="#attr_ba_Session__min_players">min_players</a>, <a href="#attr_ba_Session__players">players</a>, <a href="#attr_ba_Session__teams">teams</a></h5>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_TeamBaseSession__announce_game_results">announce_game_results()</a>, <a href="#method_ba_TeamBaseSession__begin_next_activity">begin_next_activity()</a>, <a href="#method_ba_TeamBaseSession__end">end()</a>, <a href="#method_ba_TeamBaseSession__end_activity">end_activity()</a>, <a href="#method_ba_TeamBaseSession__get_custom_menu_entries">get_custom_menu_entries()</a>, <a href="#method_ba_TeamBaseSession__get_ffa_series_length">get_ffa_series_length()</a>, <a href="#method_ba_TeamBaseSession__get_game_number">get_game_number()</a>, <a href="#method_ba_TeamBaseSession__get_max_players">get_max_players()</a>, <a href="#method_ba_TeamBaseSession__get_next_game_description">get_next_game_description()</a>, <a href="#method_ba_TeamBaseSession__get_series_length">get_series_length()</a>, <a href="#method_ba_TeamBaseSession__getactivity">getactivity()</a>, <a href="#method_ba_TeamBaseSession__handlemessage">handlemessage()</a>, <a href="#method_ba_TeamBaseSession__launch_end_session_activity">launch_end_session_activity()</a>, <a href="#method_ba_TeamBaseSession__on_activity_end">on_activity_end()</a>, <a href="#method_ba_TeamBaseSession__on_player_leave">on_player_leave()</a>, <a href="#method_ba_TeamBaseSession__on_player_request">on_player_request()</a>, <a href="#method_ba_TeamBaseSession__on_team_join">on_team_join()</a>, <a href="#method_ba_TeamBaseSession__on_team_leave">on_team_leave()</a>, <a href="#method_ba_TeamBaseSession__set_activity">set_activity()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_FreeForAllSession____init__">&lt;constructor&gt;</a>, <a href="#method_ba_FreeForAllSession__get_ffa_point_awards">get_ffa_point_awards()</a></h5>
<dl>
<dt><h4><a name="method_ba_FreeForAllSession____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.FreeForAllSession()</span></p>
<p>Set up playlists and launches a <a href="#class_ba_Activity">ba.Activity</a> to accept joiners.</p>
</dd>
<dt><h4><a name="method_ba_FreeForAllSession__get_ffa_point_awards">get_ffa_point_awards()</a></dt></h4><dd>
<p><span>get_ffa_point_awards(self) -&gt; Dict[int, int]</span></p>
<p>Return the number of points awarded for different rankings.</p>
<p>This is based on the current number of players.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_FreezeMessage">ba.FreezeMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object to become frozen.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<p> As seen in the effects of an ice ba.Bomb.
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_FreezeMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.FreezeMessage()</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_GameActivity">ba.GameActivity</a></strong></h3>
<p>inherits from: <a href="#class_ba_Activity">ba.Activity</a>, <a href="#class_ba_DependencyComponent">ba.DependencyComponent</a></p>
<p>Common base class for all game ba.Activities.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Activity__players">players</a>, <a href="#attr_ba_Activity__settings">settings</a>, <a href="#attr_ba_Activity__teams">teams</a></h5>
<h3>Attributes Defined Here:</h3>
<h5><a href="#attr_ba_GameActivity__map">map</a>, <a href="#attr_ba_GameActivity__session">session</a>, <a href="#attr_ba_GameActivity__stats">stats</a></h5>
<dl>
<dt><h4><a name="attr_ba_GameActivity__map">map</a></h4></dt><dd>
<p><span><a href="#class_ba_Map">ba.Map</a></span></p>
<p>The map being used for this game.</p>
<p> Raises a <a href="#class_ba_NotFoundError">ba.NotFoundError</a> if the map does not currently exist.</p>
</dd>
<dt><h4><a name="attr_ba_GameActivity__session">session</a></h4></dt><dd>
<p><span><a href="#class_ba_Session">ba.Session</a></span></p>
<p>The <a href="#class_ba_Session">ba.Session</a> this <a href="#class_ba_Activity">ba.Activity</a> belongs go.</p>
<p> Raises a <a href="#class_ba_SessionNotFoundError">ba.SessionNotFoundError</a> if the Session no longer exists.</p>
</dd>
<dt><h4><a name="attr_ba_GameActivity__stats">stats</a></h4></dt><dd>
<p><span><a href="#class_ba_Stats">ba.Stats</a></span></p>
<p>The stats instance accessible while the activity is running.</p>
<p> If access is attempted before or after, raises a <a href="#class_ba_NotFoundError">ba.NotFoundError</a>.</p>
</dd>
</dl>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_Activity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_Activity__begin">begin()</a>, <a href="#method_ba_Activity__create_player_node">create_player_node()</a>, <a href="#method_ba_Activity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_Activity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_Activity__has_begun">has_begun()</a>, <a href="#method_ba_Activity__has_ended">has_ended()</a>, <a href="#method_ba_Activity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_Activity__is_expired">is_expired()</a>, <a href="#method_ba_Activity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_Activity__on_expire">on_expire()</a>, <a href="#method_ba_Activity__on_team_join">on_team_join()</a>, <a href="#method_ba_Activity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Activity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_Activity__retain_actor">retain_actor()</a>, <a href="#method_ba_Activity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_Activity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_Activity__start_transition_in">start_transition_in()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_GameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__end">end()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_resolved_score_info">get_resolved_score_info()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_settings">get_settings()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_begin">on_begin()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_GameActivity__supports_session_type">supports_session_type()</a></h5>
<dl>
<dt><h4><a name="method_ba_GameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.GameActivity(settings: Dict[str, Any])</span></p>
<p>Instantiate the Activity.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a></dt></h4><dd>
<p><span>continue_or_end_game(self) -&gt; None</span></p>
<p>If continues are allowed, prompts the player to purchase a continue
and calls either end_game or continue_game depending on the result</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__create_config_ui">create_config_ui()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>create_config_ui(sessionclass: Type[<a href="#class_ba_Session">ba.Session</a>], config: Optional[Dict[str, Any]], completion_call: Callable[[Optional[Dict[str, Any]]], None]) -&gt; None </span></p>
<p>Launch an in-game UI to configure settings for a game type.</p>
<p>'sessionclass' should be the <a href="#class_ba_Session">ba.Session</a> class the game will be used in.</p>
<p>'config' should be an existing config dict (specifies 'edit' ui mode)
or None (specifies 'add' ui mode).</p>
<p>'completion_call' will be called with a filled-out config dict on
success or None on cancel.</p>
<p>Generally subclasses don't need to override this; if they override
<a href="#method_ba_GameActivity__get_settings">ba.GameActivity.get_settings</a>() and <a href="#method_ba_GameActivity__get_supported_maps">ba.GameActivity.get_supported_maps</a>()
they can just rely on the default implementation here which calls those
methods.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__end">end()</a></dt></h4><dd>
<p><span>end(self, results: Any = None, delay: float = 0.0, force: bool = False) -&gt; None</span></p>
<p>Commences Activity shutdown and delivers results to the <a href="#class_ba_Session">ba.Session</a>.</p>
<p>'delay' is the time delay before the Activity actually ends
(in seconds). Further calls to end() will be ignored up until
this time, unless 'force' is True, in which case the new results
will replace the old.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__end_game">end_game()</a></dt></h4><dd>
<p><span>end_game(self) -&gt; None</span></p>
<p>Tells the game to wrap itself up and call <a href="#method_ba_Activity__end">ba.Activity.end</a>()
immediately. This method should be overridden by subclasses.</p>
<p>A game should always be prepared to end and deliver results, even if
there is no 'winner' yet; this way things like the standard time-limit
(<a href="#method_ba_GameActivity__setup_standard_time_limit">ba.GameActivity.setup_standard_time_limit</a>()) will work with the game.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_config_display_string">get_config_display_string()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_config_display_string(config: Dict[str, Any]) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a> </span></p>
<p>Given a game config dict, return a short description for it.</p>
<p>This is used when viewing game-lists or showing what game
is up next in a series.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_description">get_description()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_description(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; str </span></p>
<p>Subclasses should override this to return a description for this
activity type (in English) within the context of the given
<a href="#class_ba_Session">ba.Session</a> type.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_description_display_string">get_description_display_string()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_description_display_string(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a> </span></p>
<p>Return a translated version of get_description().</p>
<p>Sub-classes should override get_description(); not this.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_display_string">get_display_string()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_display_string(settings: Optional[Dict] = None) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a> </span></p>
<p>Return a descriptive name for this game/settings combo.</p>
<p>Subclasses should override get_name(); not this.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_description">get_instance_description()</a></dt></h4><dd>
<p><span>get_instance_description(self) -&gt; Union[str, Sequence]</span></p>
<p>Return a description for this game instance, in English.</p>
<p>This is shown in the center of the screen below the game name at the
start of a game. It should start with a capital letter and end with a
period, and can be a bit more verbose than the version returned by
get_instance_scoreboard_description().</p>
<p>Note that translation is applied by looking up the specific returned
value as a key, so the number of returned variations should be limited;
ideally just one or two. To include arbitrary values in the
description, you can return a sequence of values in the following
form instead of just a string:</p>
<pre><span><em><small># this will give us something like 'Score 3 goals.' in English</small></em></span>
<span><em><small># and can properly translate to 'Anota 3 goles.' in Spanish.</small></em></span>
<span><em><small># If we just returned the string 'Score 3 Goals' here, there would</small></em></span>
<span><em><small># have to be a translation entry for each specific number. ew.</small></em></span>
return ['Score ${ARG1} goals.', self.settings['Score to Win']]</pre>
<p>This way the first string can be consistently translated, with any arg
values then substituted into the result. ${ARG1} will be replaced with
the first value, ${ARG2} with the second, etc.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a></dt></h4><dd>
<p><span>get_instance_display_string(self) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return a name for this particular game instance.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a></dt></h4><dd>
<p><span>get_instance_scoreboard_description(self) -&gt; Union[str, Sequence]</span></p>
<p>Return a short description for this game instance in English.</p>
<p>This description is used above the game scoreboard in the
corner of the screen, so it should be as concise as possible.
It should be lowercase and should not contain periods or other
punctuation.</p>
<p>Note that translation is applied by looking up the specific returned
value as a key, so the number of returned variations should be limited;
ideally just one or two. To include arbitrary values in the
description, you can return a sequence of values in the following form
instead of just a string:</p>
<pre><span><em><small># this will give us something like 'score 3 goals' in English</small></em></span>
<span><em><small># and can properly translate to 'anota 3 goles' in Spanish.</small></em></span>
<span><em><small># If we just returned the string 'score 3 goals' here, there would</small></em></span>
<span><em><small># have to be a translation entry for each specific number. ew.</small></em></span>
return ['score ${ARG1} goals', self.settings['Score to Win']]</pre>
<p>This way the first string can be consistently translated, with any arg
values then substituted into the result. ${ARG1} will be replaced
with the first value, ${ARG2} with the second, etc.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a></dt></h4><dd>
<p><span>get_instance_scoreboard_display_string(self) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return a name for this particular game instance.</p>
<p>This name is used above the game scoreboard in the corner
of the screen, so it should be as concise as possible.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_name">get_name()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_name() -&gt; str </span></p>
<p>Return a str name for this game type.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_resolved_score_info">get_resolved_score_info()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_resolved_score_info() -&gt; Dict[str, Any] </span></p>
<p>Call this to return a game's score info with all missing values
filled in with defaults. This should not be overridden; override
get_score_info() instead.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_score_info">get_score_info()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_score_info() -&gt; Dict[str, Any] </span></p>
<p>Return info about game scoring setup; should be overridden by games.</p>
<p>They should return a dict containing any of the following (missing
values will be default):</p>
<p>'score_name': a label shown to the user for scores; 'Score',
'Time Survived', etc. 'Score' is the default.</p>
<p>'lower_is_better': a boolean telling whether lower scores are
preferable instead of higher (the default).</p>
<p>'none_is_winner': specifies whether a score value of None is considered
better than other scores or worse. Default is False.</p>
<p>'score_type': can be 'seconds', 'milliseconds', or 'points'.</p>
<p>'score_version': to change high-score lists used by a game without
renaming the game, change this. Defaults to empty string.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_settings">get_settings()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_settings(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; List[Tuple[str, Dict[str, Any]]] </span></p>
<p>Called by the default <a href="#method_ba_GameActivity__create_config_ui">ba.GameActivity.create_config_ui</a>()
implementation; should return a dict of config options to be presented
to the user for the given <a href="#class_ba_Session">ba.Session</a> type.</p>
<p>The format for settings is a list of 2-member tuples consisting
of a name and a dict of options.</p>
<p><strong>Available Setting Options:</strong></p>
<p>'default': This determines the default value as well as the
type (int, float, or bool)</p>
<p>'min_value': Minimum value for int/float settings.</p>
<p>'max_value': Maximum value for int/float settings.</p>
<p>'choices': A list of name/value pairs the user can choose from by name.</p>
<p>'increment': Value increment for int/float settings.</p>
<pre><span><em><small># example get_settings() implementation for a capture-the-flag game:</small></em></span>
@classmethod
def get_settings(cls,sessiontype):
return [("Score to Win", {
'default': 3,
'min_value': 1
}),
("Flag Touch Return Time", {
'default': 0,
'min_value': 0,
'increment': 1
}),
("Flag Idle Return Time", {
'default': 30,
'min_value': 5,
'increment': 5
}),
("Time Limit", {
'default': 0,
'choices': [
('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)
]
}),
("Respawn Times", {
'default': 1.0,
'choices': [
('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)
]
}),
("Epic Mode", {
'default': False
})]</pre>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_supported_maps">get_supported_maps()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_supported_maps(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; List[str] </span></p>
<p>Called by the default <a href="#method_ba_GameActivity__create_config_ui">ba.GameActivity.create_config_ui</a>()
implementation; should return a list of map names valid
for this game-type for the given <a href="#class_ba_Session">ba.Session</a> type.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_team_display_string">get_team_display_string()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_team_display_string(name: str) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a> </span></p>
<p>Given a team name, returns a localized version of it.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(self, msg: Any) -&gt; Any</span></p>
<p>General message handling; can be passed any <a href="#class_category_Message_Classes">message object</a>.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a></dt></h4><dd>
<p><span>is_waiting_for_continue(self) -&gt; bool</span></p>
<p>Returns whether or not this activity is currently waiting for the
player to continue (or timeout)</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__on_begin">on_begin()</a></dt></h4><dd>
<p><span>on_begin(self) -&gt; None</span></p>
<p>Called once the previous <a href="#class_ba_Activity">ba.Activity</a> has finished transitioning out.</p>
<p>At this point the activity's initial players and teams are filled in
and it should begin its actual game logic.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__on_continue">on_continue()</a></dt></h4><dd>
<p><span>on_continue(self) -&gt; None</span></p>
<p>This is called if a game supports and offers a continue and the player
accepts. In this case the player should be given an extra life or
whatever is relevant to keep the game going.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__on_player_join">on_player_join()</a></dt></h4><dd>
<p><span>on_player_join(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Called when a new <a href="#class_ba_Player">ba.Player</a> has joined the Activity.</p>
<p>(including the initial set of Players)</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__on_player_leave">on_player_leave()</a></dt></h4><dd>
<p><span>on_player_leave(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Called when a <a href="#class_ba_Player">ba.Player</a> is leaving the Activity.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__on_transition_in">on_transition_in()</a></dt></h4><dd>
<p><span>on_transition_in(self) -&gt; None</span></p>
<p>Called when the Activity is first becoming visible.</p>
<p>Upon this call, the Activity should fade in backgrounds,
start playing music, etc. It does not yet have access to <a href="#class_ba_Player">ba.Players</a>
or <a href="#class_ba_Team">ba.Teams</a>, however. They remain owned by the previous Activity
up until <a href="#method_ba_Activity__on_begin">ba.Activity.on_begin</a>() is called.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__project_flag_stand">project_flag_stand()</a></dt></h4><dd>
<p><span>project_flag_stand(self, pos: Sequence[float]) -&gt; None</span></p>
<p>Project a flag-stand onto the ground at the given position.</p>
<p>Useful for games such as capture-the-flag to show where a
movable flag originated from.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__respawn_player">respawn_player()</a></dt></h4><dd>
<p><span>respawn_player(self, player: <a href="#class_ba_Player">ba.Player</a>, respawn_time: Optional[float] = None) -&gt; None</span></p>
<p>Given a <a href="#class_ba_Player">ba.Player</a>, sets up a standard respawn timer,
along with the standard counter display, etc.
At the end of the respawn period spawn_player() will
be called if the Player still exists.
An explicit 'respawn_time' can optionally be provided
(in seconds).</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a></dt></h4><dd>
<p><span>setup_standard_powerup_drops(self, enable_tnt: bool = True) -&gt; None</span></p>
<p>Create standard powerup drops for the current map.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a></dt></h4><dd>
<p><span>setup_standard_time_limit(self, duration: float) -&gt; None</span></p>
<p>Create a standard game time-limit given the provided
duration in seconds.
This will be displayed at the top of the screen.
If the time-limit expires, end_game() will be called.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__show_info">show_info()</a></dt></h4><dd>
<p><span>show_info(self) -&gt; None</span></p>
<p>Show the game description.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a></dt></h4><dd>
<p><span>show_scoreboard_info(self) -&gt; None</span></p>
<p>Create the game info display.</p>
<p>This is the thing in the top left corner showing the name
and short description of the game.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__show_zoom_message">show_zoom_message()</a></dt></h4><dd>
<p><span>show_zoom_message(self, message: <a href="#class_ba_Lstr">ba.Lstr</a>, color: Sequence[float] = (0.9, 0.4, 0.0), scale: float = 0.8, duration: float = 2.0, trail: bool = False) -&gt; None</span></p>
<p>Zooming text used to announce game names and winners.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__spawn_player">spawn_player()</a></dt></h4><dd>
<p><span>spawn_player(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; <a href="#class_ba_Actor">ba.Actor</a></span></p>
<p>Spawn *something* for the provided <a href="#class_ba_Player">ba.Player</a>.</p>
<p>The default implementation simply calls spawn_player_spaz().</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a></dt></h4><dd>
<p><span>spawn_player_if_exists(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>A utility method which calls self.spawn_player() *only* if the
<a href="#class_ba_Player">ba.Player</a> provided still exists; handy for use in timers and whatnot.</p>
<p>There is no need to override this; just override spawn_player().</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__spawn_player_spaz">spawn_player_spaz()</a></dt></h4><dd>
<p><span>spawn_player_spaz(self, player: <a href="#class_ba_Player">ba.Player</a>, position: Sequence[float] = (0, 0, 0), angle: float = None) -&gt; PlayerSpaz</span></p>
<p>Create and wire up a ba.PlayerSpaz for the provided <a href="#class_ba_Player">ba.Player</a>.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__supports_session_type">supports_session_type()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>supports_session_type(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; bool </span></p>
<p>Return whether this game supports the provided Session type.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_HitMessage">ba.HitMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object it has been hit in some way.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<p> This is used by punches, explosions, etc to convey
their effect to a target.
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_HitMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.HitMessage(srcnode: '<a href="#class_ba_Node">ba.Node</a>' = None, pos: 'Sequence[float]' = None, velocity: 'Sequence[float]' = None, magnitude: 'float' = 1.0, velocity_magnitude: 'float' = 0.0, radius: 'float' = 1.0, source_player: '<a href="#class_ba_Player">ba.Player</a>' = None, kick_back: 'float' = 1.0, flat_damage: 'float' = None, hit_type: 'str' = 'generic', force_direction: 'Sequence[float]' = None, hit_subtype: 'str' = 'default')</span></p>
<p>Instantiate a message with given values.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_ImpactDamageMessage">ba.ImpactDamageMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object that it has been jarred violently.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_ImpactDamageMessage__intensity">intensity</a></h4></dt><dd>
<p><span>float</span></p>
<p>The intensity of the impact.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_ImpactDamageMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.ImpactDamageMessage(intensity: float)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_InputDevice">ba.InputDevice</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>An input-device such as a gamepad, touchscreen, or keyboard.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_InputDevice__allows_configuring">allows_configuring</a>, <a href="#attr_ba_InputDevice__client_id">client_id</a>, <a href="#attr_ba_InputDevice__exists">exists</a>, <a href="#attr_ba_InputDevice__id">id</a>, <a href="#attr_ba_InputDevice__instance_number">instance_number</a>, <a href="#attr_ba_InputDevice__is_controller_app">is_controller_app</a>, <a href="#attr_ba_InputDevice__is_remote_client">is_remote_client</a>, <a href="#attr_ba_InputDevice__name">name</a>, <a href="#attr_ba_InputDevice__player">player</a>, <a href="#attr_ba_InputDevice__unique_identifier">unique_identifier</a></h5>
<dl>
<dt><h4><a name="attr_ba_InputDevice__allows_configuring">allows_configuring</a></h4></dt><dd>
<p><span> bool</span></p>
<p>Whether the input-device can be configured.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__client_id">client_id</a></h4></dt><dd>
<p><span> int</span></p>
<p>The numeric client-id this device is associated with.
This is only meaningful for remote client inputs; for
all local devices this will be -1.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__exists">exists</a></h4></dt><dd>
<p><span> bool</span></p>
<p>Whether the underlying device for this object is still present.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__id">id</a></h4></dt><dd>
<p><span> int</span></p>
<p>The unique numeric id of this device.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__instance_number">instance_number</a></h4></dt><dd>
<p><span> int</span></p>
<p>The number of this device among devices of the same type.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__is_controller_app">is_controller_app</a></h4></dt><dd>
<p><span> bool</span></p>
<p>Whether this input-device represents a locally-connected
controller-app.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__is_remote_client">is_remote_client</a></h4></dt><dd>
<p><span> bool</span></p>
<p>Whether this input-device represents a remotely-connected
client.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__name">name</a></h4></dt><dd>
<p><span> str</span></p>
<p>The name of the device.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__player">player</a></h4></dt><dd>
<p><span> Optional[<a href="#class_ba_Player">ba.Player</a>]</span></p>
<p>The player associated with this input device.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__unique_identifier">unique_identifier</a></h4></dt><dd>
<p><span> str</span></p>
<p>A string that can be used to persistently identify the device,
even among other devices of the same type. Used for saving
prefs, etc.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_InputDevice__get_account_name">get_account_name()</a>, <a href="#method_ba_InputDevice__get_axis_name">get_axis_name()</a>, <a href="#method_ba_InputDevice__get_button_name">get_button_name()</a></h5>
<dl>
<dt><h4><a name="method_ba_InputDevice__get_account_name">get_account_name()</a></dt></h4><dd>
<p><span>get_account_name(full: bool) -&gt; str</span></p>
<p>Returns the account name associated with this device.</p>
<p>(can be used to get account names for remote players)</p>
</dd>
<dt><h4><a name="method_ba_InputDevice__get_axis_name">get_axis_name()</a></dt></h4><dd>
<p><span>get_axis_name(axis_id: int) -&gt; str</span></p>
<p>Given an axis ID, returns the name of the axis on this device.</p>
</dd>
<dt><h4><a name="method_ba_InputDevice__get_button_name">get_button_name()</a></dt></h4><dd>
<p><span>get_button_name(button_id: int) -&gt; str</span></p>
<p>Given a button ID, returns the name of the key/button on this device.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_InputDeviceNotFoundError">ba.InputDeviceNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_InputDevice">ba.InputDevice</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_Level">ba.Level</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>An entry in a <a href="#class_ba_Campaign">ba.Campaign</a> consisting of a name, game type, and settings.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Level__complete">complete</a>, <a href="#attr_ba_Level__displayname">displayname</a>, <a href="#attr_ba_Level__gametype">gametype</a>, <a href="#attr_ba_Level__index">index</a>, <a href="#attr_ba_Level__name">name</a>, <a href="#attr_ba_Level__preview_texture_name">preview_texture_name</a>, <a href="#attr_ba_Level__rating">rating</a></h5>
<dl>
<dt><h4><a name="attr_ba_Level__complete">complete</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether this Level has been completed.</p>
</dd>
<dt><h4><a name="attr_ba_Level__displayname">displayname</a></h4></dt><dd>
<p><span><a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>The localized name for this Level.</p>
</dd>
<dt><h4><a name="attr_ba_Level__gametype">gametype</a></h4></dt><dd>
<p><span>Type[<a href="#class_ba_GameActivity">ba.GameActivity</a>]</span></p>
<p>The type of game used for this Level.</p>
</dd>
<dt><h4><a name="attr_ba_Level__index">index</a></h4></dt><dd>
<p><span>int</span></p>
<p>The zero-based index of this Level in its <a href="#class_ba_Campaign">ba.Campaign</a>.</p>
<p> Access results in a RuntimeError if the Level is not assigned to a
Campaign.</p>
</dd>
<dt><h4><a name="attr_ba_Level__name">name</a></h4></dt><dd>
<p><span>str</span></p>
<p>The unique name for this Level.</p>
</dd>
<dt><h4><a name="attr_ba_Level__preview_texture_name">preview_texture_name</a></h4></dt><dd>
<p><span>str</span></p>
<p>The preview texture name for this Level.</p>
</dd>
<dt><h4><a name="attr_ba_Level__rating">rating</a></h4></dt><dd>
<p><span>float</span></p>
<p>The current rating for this Level.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Level____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Level__get_campaign">get_campaign()</a>, <a href="#method_ba_Level__get_high_scores">get_high_scores()</a>, <a href="#method_ba_Level__get_preview_texture">get_preview_texture()</a>, <a href="#method_ba_Level__get_score_version_string">get_score_version_string()</a>, <a href="#method_ba_Level__get_settings">get_settings()</a>, <a href="#method_ba_Level__set_complete">set_complete()</a>, <a href="#method_ba_Level__set_high_scores">set_high_scores()</a>, <a href="#method_ba_Level__set_rating">set_rating()</a></h5>
<dl>
<dt><h4><a name="method_ba_Level____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Level(name: str, gametype: Type[<a href="#class_ba_GameActivity">ba.GameActivity</a>], settings: Dict[str, Any], preview_texture_name: str, displayname: str = None)</span></p>
<p>Initializes a Level object with the provided values.</p>
</dd>
<dt><h4><a name="method_ba_Level__get_campaign">get_campaign()</a></dt></h4><dd>
<p><span>get_campaign(self) -&gt; Optional[<a href="#class_ba_Campaign">ba.Campaign</a>]</span></p>
<p>Return the <a href="#class_ba_Campaign">ba.Campaign</a> this Level is associated with, or None.</p>
</dd>
<dt><h4><a name="method_ba_Level__get_high_scores">get_high_scores()</a></dt></h4><dd>
<p><span>get_high_scores(self) -&gt; Dict</span></p>
<p>Return the current high scores for this Level.</p>
</dd>
<dt><h4><a name="method_ba_Level__get_preview_texture">get_preview_texture()</a></dt></h4><dd>
<p><span>get_preview_texture(self) -&gt; <a href="#class_ba_Texture">ba.Texture</a></span></p>
<p>Load/return the preview Texture for this Level.</p>
</dd>
<dt><h4><a name="method_ba_Level__get_score_version_string">get_score_version_string()</a></dt></h4><dd>
<p><span>get_score_version_string(self) -&gt; str</span></p>
<p>Return the score version string for this Level.</p>
<p>If a Level's gameplay changes significantly, its version string
can be changed to separate its new high score lists/etc. from the old.</p>
</dd>
<dt><h4><a name="method_ba_Level__get_settings">get_settings()</a></dt></h4><dd>
<p><span>get_settings(self) -&gt; Dict[str, Any]</span></p>
<p>Returns the settings for this Level.</p>
</dd>
<dt><h4><a name="method_ba_Level__set_complete">set_complete()</a></dt></h4><dd>
<p><span>set_complete(self, val: bool) -&gt; None</span></p>
<p>Set whether or not this level is complete.</p>
</dd>
<dt><h4><a name="method_ba_Level__set_high_scores">set_high_scores()</a></dt></h4><dd>
<p><span>set_high_scores(self, high_scores: Dict) -&gt; None</span></p>
<p>Set high scores for this level.</p>
</dd>
<dt><h4><a name="method_ba_Level__set_rating">set_rating()</a></dt></h4><dd>
<p><span>set_rating(self, rating: float) -&gt; None</span></p>
<p>Set a rating for this Level, replacing the old ONLY IF higher.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Lobby">ba.Lobby</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Container for <a href="#class_ba_Chooser">ba.Choosers</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Lobby__teams">teams</a>, <a href="#attr_ba_Lobby__use_team_colors">use_team_colors</a></h5>
<dl>
<dt><h4><a name="attr_ba_Lobby__teams">teams</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_Team">ba.Team</a>]</span></p>
<p>Teams available in this lobby.</p>
</dd>
<dt><h4><a name="attr_ba_Lobby__use_team_colors">use_team_colors</a></h4></dt><dd>
<p><span>bool</span></p>
<p>A bool for whether this lobby is using team colors.</p>
<p> If False, inidividual player colors are used instead.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Lobby____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Lobby__add_chooser">add_chooser()</a>, <a href="#method_ba_Lobby__check_all_ready">check_all_ready()</a>, <a href="#method_ba_Lobby__create_join_info">create_join_info()</a>, <a href="#method_ba_Lobby__get_choosers">get_choosers()</a>, <a href="#method_ba_Lobby__reload_profiles">reload_profiles()</a>, <a href="#method_ba_Lobby__remove_all_choosers">remove_all_choosers()</a>, <a href="#method_ba_Lobby__remove_all_choosers_and_kick_players">remove_all_choosers_and_kick_players()</a>, <a href="#method_ba_Lobby__remove_chooser">remove_chooser()</a>, <a href="#method_ba_Lobby__update_positions">update_positions()</a></h5>
<dl>
<dt><h4><a name="method_ba_Lobby____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Lobby()</span></p>
</dd>
<dt><h4><a name="method_ba_Lobby__add_chooser">add_chooser()</a></dt></h4><dd>
<p><span>add_chooser(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Add a chooser to the lobby for the provided player.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__check_all_ready">check_all_ready()</a></dt></h4><dd>
<p><span>check_all_ready(self) -&gt; bool</span></p>
<p>Return whether all choosers are marked ready.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__create_join_info">create_join_info()</a></dt></h4><dd>
<p><span>create_join_info(self) -&gt; JoinInfo</span></p>
<p>Create a display of on-screen information for joiners.</p>
<p>(how to switch teams, players, etc.)
Intended for use in initial joining-screens.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__get_choosers">get_choosers()</a></dt></h4><dd>
<p><span>get_choosers(self) -&gt; List[Chooser]</span></p>
<p>Return the lobby's current choosers.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__reload_profiles">reload_profiles()</a></dt></h4><dd>
<p><span>reload_profiles(self) -&gt; None</span></p>
<p>Reload available player profiles.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__remove_all_choosers">remove_all_choosers()</a></dt></h4><dd>
<p><span>remove_all_choosers(self) -&gt; None</span></p>
<p>Remove all choosers without kicking players.</p>
<p>This is called after all players check in and enter a game.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__remove_all_choosers_and_kick_players">remove_all_choosers_and_kick_players()</a></dt></h4><dd>
<p><span>remove_all_choosers_and_kick_players(self) -&gt; None</span></p>
<p>Remove all player choosers and kick attached players.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__remove_chooser">remove_chooser()</a></dt></h4><dd>
<p><span>remove_chooser(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Remove a single player's chooser; does not kick him.</p>
<p>This is used when a player enters the game and no longer
needs a chooser.</p>
</dd>
<dt><h4><a name="method_ba_Lobby__update_positions">update_positions()</a></dt></h4><dd>
<p><span>update_positions(self) -&gt; None</span></p>
<p>Update positions for all choosers.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Lstr">ba.Lstr</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Used to specify strings in a language-independent way.</p>
<p>Category: <a href="#class_category_General_Utility_Classes">General Utility Classes</a></p>
<p> These should be used whenever possible in place of hard-coded strings
so that in-game or UI elements show up correctly on all clients in their
currently-active language.</p>
<p> To see available resource keys, look at any of the bs_language_*.py files
in the game or the translations pages at bombsquadgame.com/translate.</p>
<pre><span><em><small> # EXAMPLE 1: specify a string from a resource path</small></em></span>
mynode.text = <a href="#class_ba_Lstr">ba.Lstr</a>(resource='audioSettingsWindow.titleText')</pre>
<pre><span><em><small> # EXAMPLE 2: specify a translated string via a category and english value;</small></em></span>
<span><em><small> # if a translated value is available, it will be used; otherwise the</small></em></span>
<span><em><small> # english value will be. To see available translation categories, look</small></em></span>
<span><em><small> # under the 'translations' resource section.</small></em></span>
mynode.text = <a href="#class_ba_Lstr">ba.Lstr</a>(translate=('gameDescriptions', 'Defeat all enemies'))</pre>
<pre><span><em><small> # EXAMPLE 3: specify a raw value and some substitutions. Substitutions can</small></em></span>
<span><em><small> # be used with resource and translate modes as well.</small></em></span>
mynode.text = <a href="#class_ba_Lstr">ba.Lstr</a>(value='${A} / ${B}',
subs=[('${A}', str(score)), ('${B}', str(total))])</pre>
<pre><span><em><small> # EXAMPLE 4: Lstrs can be nested. This example would display the resource</small></em></span>
<span><em><small> # at res_a but replace ${NAME} with the value of the resource at res_b</small></em></span>
mytextnode.text = <a href="#class_ba_Lstr">ba.Lstr</a>(resource='res_a',
subs=[('${NAME}', <a href="#class_ba_Lstr">ba.Lstr</a>(resource='res_b'))])
</pre>
<h3>Methods:</h3>
<h5><a href="#method_ba_Lstr____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Lstr__evaluate">evaluate()</a>, <a href="#method_ba_Lstr__is_flat_value">is_flat_value()</a></h5>
<dl>
<dt><h4><a name="method_ba_Lstr____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Lstr(*args: Any, **keywds: Any)</span></p>
<p>Instantiate a Lstr.</p>
<p>Pass a value for either 'resource', 'translate',
or 'value'. (see Lstr help for examples).
'subs' can be a sequence of 2-member sequences consisting of values
and replacements.
'fallback_resource' can be a resource key that will be used if the
main one is not present for
the current language in place of falling back to the english value
('resource' mode only).
'fallback_value' can be a literal string that will be used if neither
the resource nor the fallback resource is found ('resource' mode only).</p>
</dd>
<dt><h4><a name="method_ba_Lstr__evaluate">evaluate()</a></dt></h4><dd>
<p><span>evaluate(self) -&gt; str</span></p>
<p>Evaluate the Lstr and returns a flat string in the current language.</p>
<p>You should avoid doing this as much as possible and instead pass
and store Lstr values.</p>
</dd>
<dt><h4><a name="method_ba_Lstr__is_flat_value">is_flat_value()</a></dt></h4><dd>
<p><span>is_flat_value(self) -&gt; bool</span></p>
<p>Return whether the Lstr is a 'flat' value.</p>
<p>This is defined as a simple string value incorporating no translations,
resources, or substitutions. In this case it may be reasonable to
replace it with a raw string value, perform string manipulation on it,
etc.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Map">ba.Map</a></strong></h3>
<p>inherits from: <a href="#class_ba_Actor">ba.Actor</a></p>
<p>A game map.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> Consists of a collection of terrain nodes, metadata, and other
functionality comprising a game map.
</p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_Map__activity">activity</a></h4></dt><dd>
<p><span><a href="#class_ba_Activity">ba.Activity</a></span></p>
<p>The Activity this Actor was created in.</p>
<p> Raises a <a href="#class_ba_ActivityNotFoundError">ba.ActivityNotFoundError</a> if the Activity no longer exists.</p>
</dd>
</dl>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_Actor__autoretain">autoretain()</a>, <a href="#method_ba_Actor__getactivity">getactivity()</a>, <a href="#method_ba_Actor__is_alive">is_alive()</a>, <a href="#method_ba_Actor__is_expired">is_expired()</a>, <a href="#method_ba_Actor__on_expire">on_expire()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_Map____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Map__exists">exists()</a>, <a href="#method_ba_Map__get_def_bound_box">get_def_bound_box()</a>, <a href="#method_ba_Map__get_def_point">get_def_point()</a>, <a href="#method_ba_Map__get_def_points">get_def_points()</a>, <a href="#method_ba_Map__get_ffa_start_position">get_ffa_start_position()</a>, <a href="#method_ba_Map__get_flag_position">get_flag_position()</a>, <a href="#method_ba_Map__get_music_type">get_music_type()</a>, <a href="#method_ba_Map__get_name">get_name()</a>, <a href="#method_ba_Map__get_play_types">get_play_types()</a>, <a href="#method_ba_Map__get_preview_texture_name">get_preview_texture_name()</a>, <a href="#method_ba_Map__get_start_position">get_start_position()</a>, <a href="#method_ba_Map__handlemessage">handlemessage()</a>, <a href="#method_ba_Map__is_point_near_edge">is_point_near_edge()</a>, <a href="#method_ba_Map__on_preload">on_preload()</a>, <a href="#method_ba_Map__preload">preload()</a></h5>
<dl>
<dt><h4><a name="method_ba_Map____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Map(vr_overlay_offset: Optional[Sequence[float]] = None)</span></p>
<p>Instantiate a map.</p>
</dd>
<dt><h4><a name="method_ba_Map__exists">exists()</a></dt></h4><dd>
<p><span>exists(self) -&gt; bool</span></p>
<p>Returns whether the Actor is still present in a meaningful way.</p>
<p>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 <a href="#method_ba_Actor__is_alive">ba.Actor.is_alive</a>() for that).</p>
<p>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 <a href="#method_ba_Actor__autoretain">ba.Actor.autoretain</a>()</p>
<p>The default implementation of this method always return True.</p>
<p>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.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_def_bound_box">get_def_bound_box()</a></dt></h4><dd>
<p><span>get_def_bound_box(self, name: str) -&gt; Optional[Tuple[float, float, float, float, float, float]]</span></p>
<p>Return a 6 member bounds tuple or None if it is not defined.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_def_point">get_def_point()</a></dt></h4><dd>
<p><span>get_def_point(self, name: str) -&gt; Optional[Sequence[float]]</span></p>
<p>Return a single defined point or a default value in its absence.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_def_points">get_def_points()</a></dt></h4><dd>
<p><span>get_def_points(self, name: str) -&gt; List[Sequence[float]]</span></p>
<p>Return a list of named points.</p>
<p>Return as many sequential ones are defined (flag1, flag2, flag3), etc.
If none are defined, returns an empty list.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_ffa_start_position">get_ffa_start_position()</a></dt></h4><dd>
<p><span>get_ffa_start_position(self, players: Sequence[<a href="#class_ba_Player">ba.Player</a>]) -&gt; Sequence[float]</span></p>
<p>Return a random starting position in one of the FFA spawn areas.</p>
<p>If a list of <a href="#class_ba_Player">ba.Players</a> is provided; the returned points will be
as far from these players as possible.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_flag_position">get_flag_position()</a></dt></h4><dd>
<p><span>get_flag_position(self, team_index: int = None) -&gt; Sequence[float]</span></p>
<p>Return a flag position on the map for the given team index.</p>
<p>Pass None to get the default flag point.
(used for things such as king-of-the-hill)</p>
</dd>
<dt><h4><a name="method_ba_Map__get_music_type">get_music_type()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_music_type() -&gt; Optional[<a href="#class_ba_MusicType">ba.MusicType</a>] </span></p>
<p>Return a music-type string that should be played on this map.</p>
<p>If None is returned, default music will be used.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_name">get_name()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_name() -&gt; str </span></p>
<p>Return the unique name of this map, in English.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_play_types">get_play_types()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_play_types() -&gt; List[str] </span></p>
<p>Return valid play types for this map.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_preview_texture_name">get_preview_texture_name()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_preview_texture_name() -&gt; Optional[str] </span></p>
<p>Return the name of the preview texture for this map.</p>
</dd>
<dt><h4><a name="method_ba_Map__get_start_position">get_start_position()</a></dt></h4><dd>
<p><span>get_start_position(self, team_index: int) -&gt; Sequence[float]</span></p>
<p>Return a random starting position for the given team index.</p>
</dd>
<dt><h4><a name="method_ba_Map__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(self, msg: Any) -&gt; Any</span></p>
<p>General message handling; can be passed any <a href="#class_category_Message_Classes">message object</a>.</p>
</dd>
<dt><h4><a name="method_ba_Map__is_point_near_edge">is_point_near_edge()</a></dt></h4><dd>
<p><span>is_point_near_edge(self, point: <a href="#class_ba_Vec3">ba.Vec3</a>, running: bool = False) -&gt; bool</span></p>
<p>Return whether the provided point is near an edge of the map.</p>
<p>Simple bot logic uses this call to determine if they
are approaching a cliff or wall. If this returns True they will
generally not walk/run any farther away from the origin.
If 'running' is True, the buffer should be a bit larger.</p>
</dd>
<dt><h4><a name="method_ba_Map__on_preload">on_preload()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>on_preload() -&gt; Any </span></p>
<p>Called when the map is being preloaded.</p>
<p>It should return any media/data it requires to operate</p>
</dd>
<dt><h4><a name="method_ba_Map__preload">preload()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>preload() -&gt; None </span></p>
<p>Preload map media.</p>
<p>This runs the class's on_preload() method as needed to prep it to run.
Preloading should generally be done in a <a href="#class_ba_Activity">ba.Activity</a>'s __init__ method.
Note that this is a classmethod since it is not operate on map
instances but rather on the class itself before instances are made</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Material">ba.Material</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Material(label: str = None)</p>
<p>An entity applied to game objects to modify collision behavior.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p>A material can affect physical characteristics, generate sounds,
or trigger callback functions when collisions occur.</p>
<p>Materials are applied to 'parts', which are groups of one or more
rigid bodies created as part of a <a href="#class_ba_Node">ba.Node</a>. Nodes can have any number
of parts, each with its own set of materials. Generally materials are
specified as array attributes on the Node. The 'spaz' node, for
example, has various attributes such as 'materials',
'roller_materials', and 'punch_materials', which correspond to the
various parts it creates.</p>
<p>Use <a href="#class_ba_Material">ba.Material</a>() to instantiate a blank material, and then use its
add_actions() method to define what the material does.</p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_Material__label">label</a></h4></dt><dd>
<p><span> str</span></p>
<p>A label for the material; only used for debugging.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_Material__add_actions">add_actions()</a></dt></h4><dd>
<p><span>add_actions(actions: Tuple, conditions: Optional[Tuple] = None)
-&gt; None</span></p>
<p>Add one or more actions to the material, optionally with conditions.</p>
<p><strong>Conditions:</strong></p>
<p>Conditions are provided as tuples which can be combined to form boolean
logic. A single condition might look like ('condition_name', cond_arg),
or a more complex nested one might look like (('some_condition',
cond_arg), 'or', ('another_condition', cond2_arg)).</p>
<p>'and', 'or', and 'xor' are available to chain together 2 conditions, as
seen above.</p>
<p><strong>Available Conditions:</strong></p>
<p>('they_have_material', material) - does the part we're hitting have a
given <a href="#class_ba_Material">ba.Material</a>?</p>
<p>('they_dont_have_material', material) - does the part we're hitting
not have a given <a href="#class_ba_Material">ba.Material</a>?</p>
<p>('eval_colliding') - is 'collide' true at this point in material
evaluation? (see the modify_part_collision action)</p>
<p>('eval_not_colliding') - is 'collide' false at this point in material
evaluation? (see the modify_part_collision action)</p>
<p>('we_are_younger_than', age) - is our part younger than 'age'
(in milliseconds)?</p>
<p>('we_are_older_than', age) - is our part older than 'age'
(in milliseconds)?</p>
<p>('they_are_younger_than', age) - is the part we're hitting younger than
'age' (in milliseconds)?</p>
<p>('they_are_older_than', age) - is the part we're hitting older than
'age' (in milliseconds)?</p>
<p>('they_are_same_node_as_us') - does the part we're hitting belong to
the same <a href="#class_ba_Node">ba.Node</a> as us?</p>
<p>('they_are_different_node_than_us') - does the part we're hitting
belong to a different <a href="#class_ba_Node">ba.Node</a> than us?</p>
<p><strong>Actions:</strong></p>
<p>In a similar manner, actions are specified as tuples. Multiple actions
can be specified by providing a tuple of tuples.</p>
<p><strong>Available Actions:</strong></p>
<p>('call', when, callable) - calls the provided callable; 'when' can be
either 'at_connect' or 'at_disconnect'. 'at_connect' means to fire
when the two parts first come in contact; 'at_disconnect' means to
fire once they cease being in contact.</p>
<p>('message', who, when, message_obj) - sends a message object; 'who' can
be either 'our_node' or 'their_node', 'when' can be 'at_connect' or
'at_disconnect', and message_obj is the message object to send.
This has the same effect as calling the node's handlemessage()
method.</p>
<p>('modify_part_collision', attr, value) - changes some characteristic
of the physical collision that will occur between our part and their
part. This change will remain in effect as long as the two parts
remain overlapping. This means if you have a part with a material
that turns 'collide' off against parts younger than 100ms, and it
touches another part that is 50ms old, it will continue to not
collide with that part until they separate, even if the 100ms
threshold is passed. Options for attr/value are: 'physical' (boolean
value; whether a *physical* response will occur at all), 'friction'
(float value; how friction-y the physical response will be),
'collide' (boolean value; whether *any* collision will occur at all,
including non-physical stuff like callbacks), 'use_node_collide'
(boolean value; whether to honor modify_node_collision overrides for
this collision), 'stiffness' (float value, how springy the physical
response is), 'damping' (float value, how damped the physical
response is), 'bounce' (float value; how bouncy the physical response
is).</p>
<p>('modify_node_collision', attr, value) - similar to
modify_part_collision, but operates at a node-level.
collision attributes set here will remain in effect as long as
*anything* from our part's node and their part's node overlap.
A key use of this functionality is to prevent new nodes from
colliding with each other if they appear overlapped;
if modify_part_collision is used, only the individual parts that
were overlapping would avoid contact, but other parts could still
contact leaving the two nodes 'tangled up'. Using
modify_node_collision ensures that the nodes must completely
separate before they can start colliding. Currently the only attr
available here is 'collide' (a boolean value).</p>
<p>('sound', sound, volume) - plays a <a href="#class_ba_Sound">ba.Sound</a> when a collision occurs, at
a given volume, regardless of the collision speed/etc.</p>
<p>('impact_sound', sound, targetImpulse, volume) - plays a sound when a
collision occurs, based on the speed of impact. Provide a <a href="#class_ba_Sound">ba.Sound</a>, a
target-impulse, and a volume.</p>
<p>('skid_sound', sound, targetImpulse, volume) - plays a sound during a
collision when parts are 'scraping' against each other. Provide a
<a href="#class_ba_Sound">ba.Sound</a>, a target-impulse, and a volume.</p>
<p>('roll_sound', sound, targetImpulse, volume) - plays a sound during a
collision when parts are 'rolling' against each other. Provide a
<a href="#class_ba_Sound">ba.Sound</a>, a target-impulse, and a volume.</p>
<pre><span><em><small># example 1: create a material that lets us ignore</small></em></span>
<span><em><small># collisions against any nodes we touch in the first</small></em></span>
<span><em><small># 100 ms of our existence; handy for preventing us from</small></em></span>
<span><em><small># exploding outward if we spawn on top of another object:</small></em></span>
m = <a href="#class_ba_Material">ba.Material</a>()
m.add_actions(conditions=(('we_are_younger_than', 100),
'or',('they_are_younger_than', 100)),
actions=('modify_node_collision', 'collide', False))</pre>
<pre><span><em><small># example 2: send a DieMessage to anything we touch, but cause</small></em></span>
<span><em><small># no physical response. This should cause any <a href="#class_ba_Actor">ba.Actor</a> to drop dead:</small></em></span>
m = <a href="#class_ba_Material">ba.Material</a>()
m.add_actions(actions=(('modify_part_collision', 'physical', False),
('message', 'their_node', 'at_connect',
<a href="#class_ba_DieMessage">ba.DieMessage</a>())))</pre>
<pre><span><em><small># example 3: play some sounds when we're contacting the ground:</small></em></span>
m = <a href="#class_ba_Material">ba.Material</a>()
m.add_actions(conditions=('they_have_material',
<a href="#function_ba_sharedobj">ba.sharedobj</a>('footing_material')),
actions=(('impact_sound', <a href="#function_ba_getsound">ba.getsound</a>('metalHit'), 2, 5),
('skid_sound', <a href="#function_ba_getsound">ba.getsound</a>('metalSkid'), 2, 5)))</pre>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Model">ba.Model</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A reference to a model.</p>
<p>Category: <a href="#class_category_Asset_Classes">Asset Classes</a></p>
<p>Models are used for drawing.
Use <a href="#function_ba_getmodel">ba.getmodel</a>() to instantiate one.</p>
<hr>
<h2><strong><a name="class_ba_MusicPlayer">ba.MusicPlayer</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Wrangles soundtrack music playback.</p>
<p>Category: <a href="#class_category_App_Classes">App Classes</a></p>
<p> Music can be played either through the game itself
or via a platform-specific external player.
</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_MusicPlayer____init__">&lt;constructor&gt;</a>, <a href="#method_ba_MusicPlayer__on_play">on_play()</a>, <a href="#method_ba_MusicPlayer__on_select_entry">on_select_entry()</a>, <a href="#method_ba_MusicPlayer__on_set_volume">on_set_volume()</a>, <a href="#method_ba_MusicPlayer__on_shutdown">on_shutdown()</a>, <a href="#method_ba_MusicPlayer__on_stop">on_stop()</a>, <a href="#method_ba_MusicPlayer__play">play()</a>, <a href="#method_ba_MusicPlayer__select_entry">select_entry()</a>, <a href="#method_ba_MusicPlayer__set_volume">set_volume()</a>, <a href="#method_ba_MusicPlayer__shutdown">shutdown()</a>, <a href="#method_ba_MusicPlayer__stop">stop()</a></h5>
<dl>
<dt><h4><a name="method_ba_MusicPlayer____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.MusicPlayer()</span></p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__on_play">on_play()</a></dt></h4><dd>
<p><span>on_play(self, entry: Any) -&gt; None</span></p>
<p>Called when a new song/playlist/etc should be played.</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__on_select_entry">on_select_entry()</a></dt></h4><dd>
<p><span>on_select_entry(self, callback: Callable[[Any], None], current_entry: Any, selection_target_name: str) -&gt; Any</span></p>
<p>Present a GUI to select an entry.</p>
<p>The callback should be called with a valid entry or None to
signify that the default soundtrack should be used..</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__on_set_volume">on_set_volume()</a></dt></h4><dd>
<p><span>on_set_volume(self, volume: float) -&gt; None</span></p>
<p>Called when the volume should be changed.</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__on_shutdown">on_shutdown()</a></dt></h4><dd>
<p><span>on_shutdown(self) -&gt; None</span></p>
<p>Called on final app shutdown.</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__on_stop">on_stop()</a></dt></h4><dd>
<p><span>on_stop(self) -&gt; None</span></p>
<p>Called when the music should stop.</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__play">play()</a></dt></h4><dd>
<p><span>play(self, entry: Any) -&gt; None</span></p>
<p>Play provided entry.</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__select_entry">select_entry()</a></dt></h4><dd>
<p><span>select_entry(self, callback: Callable[[Any], None], current_entry: Any, selection_target_name: str) -&gt; Any</span></p>
<p>Summons a UI to select a new soundtrack entry.</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__set_volume">set_volume()</a></dt></h4><dd>
<p><span>set_volume(self, volume: float) -&gt; None</span></p>
<p>Set player volume (value should be between 0 and 1).</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__shutdown">shutdown()</a></dt></h4><dd>
<p><span>shutdown(self) -&gt; None</span></p>
<p>Shutdown music playback completely.</p>
</dd>
<dt><h4><a name="method_ba_MusicPlayer__stop">stop()</a></dt></h4><dd>
<p><span>stop(self) -&gt; None</span></p>
<p>Stop any playback that is occurring.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_MusicPlayMode">ba.MusicPlayMode</a></strong></h3>
<p>inherits from: enum.Enum</p>
<p>Influences behavior when playing music.</p>
<p>Category: <a href="#class_category_Enums">Enums</a>
</p>
<h3>Values:</h3>
<ul>
<li>REGULAR</li>
<li>TEST</li>
</ul>
<hr>
<h2><strong><a name="class_ba_MusicType">ba.MusicType</a></strong></h3>
<p>inherits from: enum.Enum</p>
<p>Types of music available to play in-game.</p>
<p>Category: <a href="#class_category_Enums">Enums</a>
</p>
<h3>Values:</h3>
<ul>
<li>MENU</li>
<li>VICTORY</li>
<li>CHAR_SELECT</li>
<li>RUN_AWAY</li>
<li>ONSLAUGHT</li>
<li>KEEP_AWAY</li>
<li>RACE</li>
<li>EPIC_RACE</li>
<li>SCORES</li>
<li>GRAND_ROMP</li>
<li>TO_THE_DEATH</li>
<li>CHOSEN_ONE</li>
<li>FORWARD_MARCH</li>
<li>FLAG_CATCHER</li>
<li>SURVIVAL</li>
<li>EPIC</li>
<li>SPORTS</li>
<li>HOCKEY</li>
<li>FOOTBALL</li>
<li>FLYING</li>
<li>SCARY</li>
<li>MARCHING</li>
</ul>
<hr>
<h2><strong><a name="class_ba_Node">ba.Node</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Reference to a Node; the low level building block of the game.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p>At its core, a game is nothing more than a scene of Nodes
with attributes getting interconnected or set over time.</p>
<p>A <a href="#class_ba_Node">ba.Node</a> instance should be thought of as a weak-reference
to a game node; *not* the node itself. This means a Node's
lifecycle is completely independent of how many Python references
to it exist. To explicitly add a new node to the game, use
<a href="#function_ba_newnode">ba.newnode</a>(), and to explicitly delete one, use <a href="#method_ba_Node__delete">ba.Node.delete</a>().
<a href="#method_ba_Node__exists">ba.Node.exists</a>() can be used to determine if a Node still points to
a live node in the game.</p>
<p>You can use <a href="#class_ba_Node">ba.Node</a>(None) to instantiate an invalid
Node reference (sometimes used as attr values/etc).</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_Node__add_death_action">add_death_action()</a>, <a href="#method_ba_Node__connectattr">connectattr()</a>, <a href="#method_ba_Node__delete">delete()</a>, <a href="#method_ba_Node__exists">exists()</a>, <a href="#method_ba_Node__get_name">get_name()</a>, <a href="#method_ba_Node__getdelegate">getdelegate()</a>, <a href="#method_ba_Node__getnodetype">getnodetype()</a>, <a href="#method_ba_Node__handlemessage">handlemessage()</a></h5>
<dl>
<dt><h4><a name="method_ba_Node__add_death_action">add_death_action()</a></dt></h4><dd>
<p><span>add_death_action(action: Callable[[], None]) -&gt; None</span></p>
<p>Add a callable object to be called upon this node's death.
Note that these actions are run just after the node dies, not before.</p>
</dd>
<dt><h4><a name="method_ba_Node__connectattr">connectattr()</a></dt></h4><dd>
<p><span>connectattr(srcattr: str, dstnode: Node, dstattr: str) -&gt; None</span></p>
<p>Connect one of this node's attributes to an attribute on another node.
This will immediately set the target attribute's value to that of the
source attribute, and will continue to do so once per step as long as
the two nodes exist. The connection can be severed by setting the
target attribute to any value or connecting another node attribute
to it.</p>
<pre><span><em><small># Example: create a locator and attach a light to it:</small></em></span>
light = <a href="#function_ba_newnode">ba.newnode</a>('light')
loc = <a href="#function_ba_newnode">ba.newnode</a>('locator', attrs={'position': (0,10,0)})
loc.connectattr('position', light, 'position')</pre>
</dd>
<dt><h4><a name="method_ba_Node__delete">delete()</a></dt></h4><dd>
<p><span>delete(ignore_missing: bool = True) -&gt; None</span></p>
<p>Delete the node. Ignores already-deleted nodes unless ignore_missing
is False, in which case an Exception is thrown.</p>
</dd>
<dt><h4><a name="method_ba_Node__exists">exists()</a></dt></h4><dd>
<p><span>exists() -&gt; bool</span></p>
<p>Returns whether the Node still exists.
Most functionality will fail on a nonexistent Node, so it's never a bad
idea to check this.</p>
<p>Note that you can also use the boolean operator for this same
functionality, so a statement such as "if mynode" will do
the right thing both for Node objects and values of None.</p>
</dd>
<dt><h4><a name="method_ba_Node__get_name">get_name()</a></dt></h4><dd>
<p><span>get_name() -&gt; str</span></p>
<p>Return the name assigned to a Node; used mainly for debugging</p>
</dd>
<dt><h4><a name="method_ba_Node__getdelegate">getdelegate()</a></dt></h4><dd>
<p><span>getdelegate() -&gt; Any</span></p>
<p>Returns the node's current delegate, which is the Python object
designated to handle the Node's messages.</p>
</dd>
<dt><h4><a name="method_ba_Node__getnodetype">getnodetype()</a></dt></h4><dd>
<p><span>getnodetype() -&gt; str</span></p>
<p>Return the type of Node referenced by this object as a string.
(Note this is different from the Python type which is always <a href="#class_ba_Node">ba.Node</a>)</p>
</dd>
<dt><h4><a name="method_ba_Node__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(*args: Any) -&gt; None</span></p>
<p>General message handling; can be passed any <a href="#class_category_Message_Classes">message object</a>.</p>
<p>All standard message objects are forwarded along to the <a href="#class_ba_Node">ba.Node</a>'s
delegate for handling (generally the <a href="#class_ba_Actor">ba.Actor</a> that made the node).</p>
<p><a href="#class_ba_Node">ba.Nodes</a> are unique, however, in that they can be passed a second
form of message; 'node-messages'. These consist of a string type-name
as a first argument along with the args specific to that type name
as additional arguments.
Node-messages communicate directly with the low-level node layer
and are delivered simultaneously on all game clients,
acting as an alternative to setting node attributes.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_NodeActor">ba.NodeActor</a></strong></h3>
<p>inherits from: <a href="#class_ba_Actor">ba.Actor</a></p>
<p>A simple <a href="#class_ba_Actor">ba.Actor</a> type that wraps a single <a href="#class_ba_Node">ba.Node</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> This Actor will delete its Node when told to die, and it's
exists() call will return whether the Node still exists or not.
</p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_NodeActor__activity">activity</a></h4></dt><dd>
<p><span><a href="#class_ba_Activity">ba.Activity</a></span></p>
<p>The Activity this Actor was created in.</p>
<p> Raises a <a href="#class_ba_ActivityNotFoundError">ba.ActivityNotFoundError</a> if the Activity no longer exists.</p>
</dd>
</dl>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_Actor__autoretain">autoretain()</a>, <a href="#method_ba_Actor__getactivity">getactivity()</a>, <a href="#method_ba_Actor__is_alive">is_alive()</a>, <a href="#method_ba_Actor__is_expired">is_expired()</a>, <a href="#method_ba_Actor__on_expire">on_expire()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_NodeActor____init__">&lt;constructor&gt;</a>, <a href="#method_ba_NodeActor__exists">exists()</a>, <a href="#method_ba_NodeActor__handlemessage">handlemessage()</a></h5>
<dl>
<dt><h4><a name="method_ba_NodeActor____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.NodeActor(node: <a href="#class_ba_Node">ba.Node</a>)</span></p>
<p>Instantiates an Actor in the current <a href="#class_ba_Activity">ba.Activity</a>.</p>
</dd>
<dt><h4><a name="method_ba_NodeActor__exists">exists()</a></dt></h4><dd>
<p><span>exists(self) -&gt; bool</span></p>
<p>Returns whether the Actor is still present in a meaningful way.</p>
<p>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 <a href="#method_ba_Actor__is_alive">ba.Actor.is_alive</a>() for that).</p>
<p>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 <a href="#method_ba_Actor__autoretain">ba.Actor.autoretain</a>()</p>
<p>The default implementation of this method always return True.</p>
<p>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.</p>
</dd>
<dt><h4><a name="method_ba_NodeActor__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(self, msg: Any) -&gt; Any</span></p>
<p>General message handling; can be passed any <a href="#class_category_Message_Classes">message object</a>.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_NodeNotFoundError">ba.NodeNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_Node">ba.Node</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_NotFoundError">ba.NotFoundError</a></strong></h3>
<p>inherits from: Exception, BaseException</p>
<p>Exception raised when a referenced object does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_builtins_Exception">builtins.Exception</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_OutOfBoundsMessage">ba.OutOfBoundsMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A message telling an object that it is out of bounds.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a>
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_OutOfBoundsMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.OutOfBoundsMessage()</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Permission">ba.Permission</a></strong></h3>
<p>inherits from: enum.Enum</p>
<p>Permissions that can be requested from the OS.</p>
<p>Category: <a href="#class_category_Enums">Enums</a>
</p>
<h3>Values:</h3>
<ul>
<li>STORAGE</li>
</ul>
<hr>
<h2><strong><a name="class_ba_PickedUpMessage">ba.PickedUpMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object that it has been picked up by something.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_PickedUpMessage__node">node</a></h4></dt><dd>
<p><span><a href="#class_ba_Node">ba.Node</a></span></p>
<p>The <a href="#class_ba_Node">ba.Node</a> doing the picking up.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_PickedUpMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.PickedUpMessage(node: <a href="#class_ba_Node">ba.Node</a>)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_PickUpMessage">ba.PickUpMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object that it has picked something up.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_PickUpMessage__node">node</a></h4></dt><dd>
<p><span><a href="#class_ba_Node">ba.Node</a></span></p>
<p>The <a href="#class_ba_Node">ba.Node</a> that is getting picked up.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_PickUpMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.PickUpMessage(node: <a href="#class_ba_Node">ba.Node</a>)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Player">ba.Player</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A reference to a player in the game.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p>These are created and managed internally and
provided to your Session/Activity instances.
Be aware that, like <a href="#class_ba_Node">ba.Nodes</a>, <a href="#class_ba_Player">ba.Player</a> objects are 'weak'
references under-the-hood; a player can leave the game at
any point. For this reason, you should make judicious use of the
<a href="#attr_ba_Player__exists">ba.Player.exists</a> attribute (or boolean operator) to ensure that a
Player is still present if retaining references to one for any
length of time.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Player__actor">actor</a>, <a href="#attr_ba_Player__character">character</a>, <a href="#attr_ba_Player__color">color</a>, <a href="#attr_ba_Player__exists">exists</a>, <a href="#attr_ba_Player__gamedata">gamedata</a>, <a href="#attr_ba_Player__highlight">highlight</a>, <a href="#attr_ba_Player__in_game">in_game</a>, <a href="#attr_ba_Player__node">node</a>, <a href="#attr_ba_Player__sessiondata">sessiondata</a>, <a href="#attr_ba_Player__team">team</a></h5>
<dl>
<dt><h4><a name="attr_ba_Player__actor">actor</a></h4></dt><dd>
<p><span> Optional[<a href="#class_ba_Actor">ba.Actor</a>]</span></p>
<p>The current <a href="#class_ba_Actor">ba.Actor</a> associated with this Player.
This may be None</p>
</dd>
<dt><h4><a name="attr_ba_Player__character">character</a></h4></dt><dd>
<p><span> str</span></p>
<p>The character this player has selected in their profile.</p>
</dd>
<dt><h4><a name="attr_ba_Player__color">color</a></h4></dt><dd>
<p><span> Sequence[float]</span></p>
<p>The base color for this Player.
In team games this will match the <a href="#class_ba_Team">ba.Team</a>'s color.</p>
</dd>
<dt><h4><a name="attr_ba_Player__exists">exists</a></h4></dt><dd>
<p><span> bool</span></p>
<p>Whether the player still exists.
Most functionality will fail on a nonexistent player.</p>
<p>Note that you can also use the boolean operator for this same
functionality, so a statement such as "if player" will do
the right thing both for Player objects and values of None.</p>
</dd>
<dt><h4><a name="attr_ba_Player__gamedata">gamedata</a></h4></dt><dd>
<p><span> Dict</span></p>
<p>A dict for use by the current <a href="#class_ba_Activity">ba.Activity</a> for
storing data associated with this Player.
This gets cleared for each new <a href="#class_ba_Activity">ba.Activity</a>.</p>
</dd>
<dt><h4><a name="attr_ba_Player__highlight">highlight</a></h4></dt><dd>
<p><span> Sequence[float]</span></p>
<p>A secondary color for this player.
This is used for minor highlights and accents
to allow a player to stand apart from his teammates
who may all share the same team (primary) color.</p>
</dd>
<dt><h4><a name="attr_ba_Player__in_game">in_game</a></h4></dt><dd>
<p><span> bool</span></p>
<p>This bool value will be True once the Player has completed
any lobby character/team selection.</p>
</dd>
<dt><h4><a name="attr_ba_Player__node">node</a></h4></dt><dd>
<p><span> Optional[<a href="#class_ba_Node">ba.Node</a>]</span></p>
<p>A <a href="#class_ba_Node">ba.Node</a> of type 'player' associated with this Player.
This Node exists in the currently active game and can be used
to get a generic player position/etc.
This will be None if the Player is not in a game.</p>
</dd>
<dt><h4><a name="attr_ba_Player__sessiondata">sessiondata</a></h4></dt><dd>
<p><span> Dict</span></p>
<p>A dict for use by the current <a href="#class_ba_Session">ba.Session</a> for
storing data associated with this player.
This persists for the duration of the session.</p>
</dd>
<dt><h4><a name="attr_ba_Player__team">team</a></h4></dt><dd>
<p><span> <a href="#class_ba_Team">ba.Team</a></span></p>
<p>The <a href="#class_ba_Team">ba.Team</a> this Player is on. If the Player is
still in its lobby selecting a team/etc. then a
<a href="#class_ba_TeamNotFoundError">ba.TeamNotFoundError</a> will be raised.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Player__assign_input_call">assign_input_call()</a>, <a href="#method_ba_Player__get_account_id">get_account_id()</a>, <a href="#method_ba_Player__get_icon">get_icon()</a>, <a href="#method_ba_Player__get_id">get_id()</a>, <a href="#method_ba_Player__get_input_device">get_input_device()</a>, <a href="#method_ba_Player__get_name">get_name()</a>, <a href="#method_ba_Player__is_alive">is_alive()</a>, <a href="#method_ba_Player__remove_from_game">remove_from_game()</a>, <a href="#method_ba_Player__reset_input">reset_input()</a>, <a href="#method_ba_Player__set_actor">set_actor()</a>, <a href="#method_ba_Player__set_name">set_name()</a></h5>
<dl>
<dt><h4><a name="method_ba_Player__assign_input_call">assign_input_call()</a></dt></h4><dd>
<p><span>assign_input_call(type: Union[str, Tuple[str, ...]],
call: Callable) -&gt; None</span></p>
<p>Set the python callable to be run for one or more types of input.
Valid type values are: 'jumpPress', 'jumpRelease', 'punchPress',
'punchRelease','bombPress', 'bombRelease', 'pickUpPress',
'pickUpRelease', 'upDown','leftRight','upPress', 'upRelease',
'downPress', 'downRelease', 'leftPress','leftRelease','rightPress',
'rightRelease', 'run', 'flyPress', 'flyRelease', 'startPress',
'startRelease'</p>
</dd>
<dt><h4><a name="method_ba_Player__get_account_id">get_account_id()</a></dt></h4><dd>
<p><span>get_account_id() -&gt; str</span></p>
<p>Return the Account ID this player is signed in under, if
there is one and it can be determined with relative certainty.
Returns None otherwise. Note that this may require an active
internet connection (especially for network-connected players)
and may return None for a short while after a player initially
joins (while verification occurs).</p>
</dd>
<dt><h4><a name="method_ba_Player__get_icon">get_icon()</a></dt></h4><dd>
<p><span>get_icon() -&gt; Dict[str, Any]</span></p>
<p>Returns the character's icon (images, colors, etc contained in a dict)</p>
</dd>
<dt><h4><a name="method_ba_Player__get_id">get_id()</a></dt></h4><dd>
<p><span>get_id() -&gt; int</span></p>
<p>Returns the unique numeric player ID for this player.</p>
</dd>
<dt><h4><a name="method_ba_Player__get_input_device">get_input_device()</a></dt></h4><dd>
<p><span>get_input_device() -&gt; <a href="#class_ba_InputDevice">ba.InputDevice</a></span></p>
<p>Returns the player's input device.</p>
</dd>
<dt><h4><a name="method_ba_Player__get_name">get_name()</a></dt></h4><dd>
<p><span>get_name(full: bool = False, icon: bool = True) -&gt; str</span></p>
<p>Returns the player's name. If icon is True, the long version of the
name may include an icon.</p>
</dd>
<dt><h4><a name="method_ba_Player__is_alive">is_alive()</a></dt></h4><dd>
<p><span>is_alive() -&gt; bool</span></p>
<p>Returns True if the player has a <a href="#class_ba_Actor">ba.Actor</a> assigned and its
is_alive() method return True. False is returned otherwise.</p>
</dd>
<dt><h4><a name="method_ba_Player__remove_from_game">remove_from_game()</a></dt></h4><dd>
<p><span>remove_from_game() -&gt; None</span></p>
<p>Removes the player from the game.</p>
</dd>
<dt><h4><a name="method_ba_Player__reset_input">reset_input()</a></dt></h4><dd>
<p><span>reset_input() -&gt; None</span></p>
<p>Clears out the player's assigned input actions.</p>
</dd>
<dt><h4><a name="method_ba_Player__set_actor">set_actor()</a></dt></h4><dd>
<p><span>set_actor(actor: Optional[<a href="#class_ba_Actor">ba.Actor</a>]) -&gt; None</span></p>
<p>Set the player's associated <a href="#class_ba_Actor">ba.Actor</a>.</p>
</dd>
<dt><h4><a name="method_ba_Player__set_name">set_name()</a></dt></h4><dd>
<p><span>set_name(name: str, full_name: str = None, real: bool = True)
-&gt; None</span></p>
<p>Set the player's name to the provided string.
A number will automatically be appended if the name is not unique from
other players.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_PlayerNotFoundError">ba.PlayerNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_Player">ba.Player</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_PlayerRecord">ba.PlayerRecord</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Stats for an individual player in a <a href="#class_ba_Stats">ba.Stats</a> object.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> This does not necessarily correspond to a <a href="#class_ba_Player">ba.Player</a> that is
still present (stats may be retained for players that leave
mid-game)
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_PlayerRecord__player">player</a>, <a href="#attr_ba_PlayerRecord__team">team</a></h5>
<dl>
<dt><h4><a name="attr_ba_PlayerRecord__player">player</a></h4></dt><dd>
<p><span><a href="#class_ba_Player">ba.Player</a></span></p>
<p>Return the instance's associated <a href="#class_ba_Player">ba.Player</a>.</p>
<p> Raises a <a href="#class_ba_PlayerNotFoundError">ba.PlayerNotFoundError</a> if the player no longer exists.</p>
</dd>
<dt><h4><a name="attr_ba_PlayerRecord__team">team</a></h4></dt><dd>
<p><span><a href="#class_ba_Team">ba.Team</a></span></p>
<p>The <a href="#class_ba_Team">ba.Team</a> the last associated player was last on.</p>
<p> This can still return a valid result even if the player is gone.
Raises a <a href="#class_ba_TeamNotFoundError">ba.TeamNotFoundError</a> if the team no longer exists.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_PlayerRecord____init__">&lt;constructor&gt;</a>, <a href="#method_ba_PlayerRecord__associate_with_player">associate_with_player()</a>, <a href="#method_ba_PlayerRecord__cancel_multi_kill_timer">cancel_multi_kill_timer()</a>, <a href="#method_ba_PlayerRecord__get_icon">get_icon()</a>, <a href="#method_ba_PlayerRecord__get_last_player">get_last_player()</a>, <a href="#method_ba_PlayerRecord__get_name">get_name()</a>, <a href="#method_ba_PlayerRecord__getactivity">getactivity()</a>, <a href="#method_ba_PlayerRecord__submit_kill">submit_kill()</a></h5>
<dl>
<dt><h4><a name="method_ba_PlayerRecord____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.PlayerRecord(name: str, name_full: str, player: <a href="#class_ba_Player">ba.Player</a>, stats: <a href="#class_ba_Stats">ba.Stats</a>)</span></p>
</dd>
<dt><h4><a name="method_ba_PlayerRecord__associate_with_player">associate_with_player()</a></dt></h4><dd>
<p><span>associate_with_player(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Associate this entry with a <a href="#class_ba_Player">ba.Player</a>.</p>
</dd>
<dt><h4><a name="method_ba_PlayerRecord__cancel_multi_kill_timer">cancel_multi_kill_timer()</a></dt></h4><dd>
<p><span>cancel_multi_kill_timer(self) -&gt; None</span></p>
<p>Cancel any multi-kill timer for this player entry.</p>
</dd>
<dt><h4><a name="method_ba_PlayerRecord__get_icon">get_icon()</a></dt></h4><dd>
<p><span>get_icon(self) -&gt; Dict[str, Any]</span></p>
<p>Get the icon for this instance's player.</p>
</dd>
<dt><h4><a name="method_ba_PlayerRecord__get_last_player">get_last_player()</a></dt></h4><dd>
<p><span>get_last_player(self) -&gt; <a href="#class_ba_Player">ba.Player</a></span></p>
<p>Return the last <a href="#class_ba_Player">ba.Player</a> we were associated with.</p>
</dd>
<dt><h4><a name="method_ba_PlayerRecord__get_name">get_name()</a></dt></h4><dd>
<p><span>get_name(self, full: bool = False) -&gt; str</span></p>
<p>Return the player entry's name.</p>
</dd>
<dt><h4><a name="method_ba_PlayerRecord__getactivity">getactivity()</a></dt></h4><dd>
<p><span>getactivity(self) -&gt; Optional[<a href="#class_ba_Activity">ba.Activity</a>]</span></p>
<p>Return the <a href="#class_ba_Activity">ba.Activity</a> this instance is currently associated with.</p>
<p>Returns None if the activity no longer exists.</p>
</dd>
<dt><h4><a name="method_ba_PlayerRecord__submit_kill">submit_kill()</a></dt></h4><dd>
<p><span>submit_kill(self, showpoints: bool = True) -&gt; None</span></p>
<p>Submit a kill for this player entry.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_PlayerScoredMessage">ba.PlayerScoredMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Informs something that a <a href="#class_ba_Player">ba.Player</a> scored.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<h3>Attributes:</h3>
<dl>
<dt><h4><a name="attr_ba_PlayerScoredMessage__score">score</a></h4></dt><dd>
<p><span>int</span></p>
<p>The score value.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_PlayerScoredMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.PlayerScoredMessage(score: int)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_PowerupAcceptMessage">ba.PowerupAcceptMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A message informing a ba.Powerup that it was accepted.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<p> This is generally sent in response to a <a href="#class_ba_PowerupMessage">ba.PowerupMessage</a>
to inform the box (or whoever granted it) that it can go away.
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_PowerupAcceptMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.PowerupAcceptMessage()</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_PowerupMessage">ba.PowerupMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A message telling an object to accept a powerup.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<p> This message is normally received by touching a ba.PowerupBox.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_PowerupMessage__poweruptype">poweruptype</a>, <a href="#attr_ba_PowerupMessage__source_node">source_node</a></h5>
<dl>
<dt><h4><a name="attr_ba_PowerupMessage__poweruptype">poweruptype</a></h4></dt><dd>
<p><span>str</span></p>
<p>The type of powerup to be granted (a string).
See ba.Powerup.poweruptype for available type values.</p>
</dd>
<dt><h4><a name="attr_ba_PowerupMessage__source_node">source_node</a></h4></dt><dd>
<p><span>Optional[<a href="#class_ba_Node">ba.Node</a>]</span></p>
<p>The node the powerup game from, or None otherwise.
If a powerup is accepted, a <a href="#class_ba_PowerupAcceptMessage">ba.PowerupAcceptMessage</a> should be sent
back to the source_node to inform it of the fact. This will generally
cause the powerup box to make a sound and disappear or whatnot.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_PowerupMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.PowerupMessage(poweruptype: str, source_node: Optional[<a href="#class_ba_Node">ba.Node</a>] = None)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Session">ba.Session</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Defines a high level series of activities with a common purpose.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> Examples of sessions are <a href="#class_ba_FreeForAllSession">ba.FreeForAllSession</a>, <a href="#class_ba_TeamsSession">ba.TeamsSession</a>, and
<a href="#class_ba_CoopSession">ba.CoopSession</a>.</p>
<p> A Session is responsible for wrangling and transitioning between various
<a href="#class_ba_Activity">ba.Activity</a> instances such as mini-games and score-screens, and for
maintaining state between them (players, teams, score tallies, etc).</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Session__campaign">campaign</a>, <a href="#attr_ba_Session__lobby">lobby</a>, <a href="#attr_ba_Session__max_players">max_players</a>, <a href="#attr_ba_Session__min_players">min_players</a>, <a href="#attr_ba_Session__players">players</a>, <a href="#attr_ba_Session__teams">teams</a></h5>
<dl>
<dt><h4><a name="attr_ba_Session__campaign">campaign</a></h4></dt><dd>
<p><span>Optional[<a href="#class_ba_Campaign">ba.Campaign</a>]</span></p>
<p>The <a href="#class_ba_Campaign">ba.Campaign</a> instance this Session represents, or None if
there is no associated Campaign.</p>
</dd>
<dt><h4><a name="attr_ba_Session__lobby">lobby</a></h4></dt><dd>
<p><span><a href="#class_ba_Lobby">ba.Lobby</a></span></p>
<p>The <a href="#class_ba_Lobby">ba.Lobby</a> instance where new <a href="#class_ba_Player">ba.Players</a> go to select a
Profile/Team/etc. before being added to games.
Be aware this value may be None if a Session does not allow
any such selection.</p>
</dd>
<dt><h4><a name="attr_ba_Session__max_players">max_players</a></h4></dt><dd>
<p><span>int</span></p>
<p>The maximum number of Players allowed in the Session.</p>
</dd>
<dt><h4><a name="attr_ba_Session__min_players">min_players</a></h4></dt><dd>
<p><span>int</span></p>
<p>The minimum number of Players who must be present for the Session
to proceed past the initial joining screen.</p>
</dd>
<dt><h4><a name="attr_ba_Session__players">players</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_Player">ba.Player</a>]</span></p>
<p>All <a href="#class_ba_Player">ba.Players</a> in the Session. Most things should use the player
list in <a href="#class_ba_Activity">ba.Activity</a>; not this. Some players, such as those who have
not yet selected a character, will only appear on this list.</p>
</dd>
<dt><h4><a name="attr_ba_Session__teams">teams</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_Team">ba.Team</a>]</span></p>
<p>All the <a href="#class_ba_Team">ba.Teams</a> in the Session. Most things should use the team
list in <a href="#class_ba_Activity">ba.Activity</a>; not this.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Session____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Session__begin_next_activity">begin_next_activity()</a>, <a href="#method_ba_Session__end">end()</a>, <a href="#method_ba_Session__end_activity">end_activity()</a>, <a href="#method_ba_Session__get_custom_menu_entries">get_custom_menu_entries()</a>, <a href="#method_ba_Session__getactivity">getactivity()</a>, <a href="#method_ba_Session__handlemessage">handlemessage()</a>, <a href="#method_ba_Session__on_activity_end">on_activity_end()</a>, <a href="#method_ba_Session__on_player_leave">on_player_leave()</a>, <a href="#method_ba_Session__on_player_request">on_player_request()</a>, <a href="#method_ba_Session__on_team_join">on_team_join()</a>, <a href="#method_ba_Session__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Session__set_activity">set_activity()</a></h5>
<dl>
<dt><h4><a name="method_ba_Session____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Session(depsets: Sequence[<a href="#class_ba_DependencySet">ba.DependencySet</a>], team_names: Sequence[str] = None, team_colors: Sequence[Sequence[float]] = None, use_team_colors: bool = True, min_players: int = 1, max_players: int = 8, allow_mid_activity_joins: bool = True)</span></p>
<p>Instantiate a session.</p>
<p>depsets should be a sequence of successfully resolved <a href="#class_ba_DependencySet">ba.DependencySet</a>
instances; one for each <a href="#class_ba_Activity">ba.Activity</a> the session may potentially run.</p>
</dd>
<dt><h4><a name="method_ba_Session__begin_next_activity">begin_next_activity()</a></dt></h4><dd>
<p><span>begin_next_activity(self) -&gt; None</span></p>
<p>Called once the previous activity has been totally torn down.</p>
<p>This means we're ready to begin the next one</p>
</dd>
<dt><h4><a name="method_ba_Session__end">end()</a></dt></h4><dd>
<p><span>end(self) -&gt; None</span></p>
<p>Initiates an end to the session and a return to the main menu.</p>
<p>Note that this happens asynchronously, allowing the
session and its activities to shut down gracefully.</p>
</dd>
<dt><h4><a name="method_ba_Session__end_activity">end_activity()</a></dt></h4><dd>
<p><span>end_activity(self, activity: <a href="#class_ba_Activity">ba.Activity</a>, results: Any, delay: float, force: bool) -&gt; None</span></p>
<p>Commence shutdown of a <a href="#class_ba_Activity">ba.Activity</a> (if not already occurring).</p>
<p>'delay' is the time delay before the Activity actually ends
(in seconds). Further calls to end() will be ignored up until
this time, unless 'force' is True, in which case the new results
will replace the old.</p>
</dd>
<dt><h4><a name="method_ba_Session__get_custom_menu_entries">get_custom_menu_entries()</a></dt></h4><dd>
<p><span>get_custom_menu_entries(self) -&gt; List[Dict[str, Any]]</span></p>
<p>Subclasses can override this to provide custom menu entries.</p>
<p>The returned value should be a list of dicts, each containing
a 'label' and 'call' entry, with 'label' being the text for
the entry and 'call' being the callable to trigger if the entry
is pressed.</p>
</dd>
<dt><h4><a name="method_ba_Session__getactivity">getactivity()</a></dt></h4><dd>
<p><span>getactivity(self) -&gt; Optional[<a href="#class_ba_Activity">ba.Activity</a>]</span></p>
<p>Return the current foreground activity for this session.</p>
</dd>
<dt><h4><a name="method_ba_Session__handlemessage">handlemessage()</a></dt></h4><dd>
<p><span>handlemessage(self, msg: Any) -&gt; Any</span></p>
<p>General message handling; can be passed any <a href="#class_category_Message_Classes">message object</a>.</p>
</dd>
<dt><h4><a name="method_ba_Session__on_activity_end">on_activity_end()</a></dt></h4><dd>
<p><span>on_activity_end(self, activity: <a href="#class_ba_Activity">ba.Activity</a>, results: Any) -&gt; None</span></p>
<p>Called when the current <a href="#class_ba_Activity">ba.Activity</a> has ended.</p>
<p>The <a href="#class_ba_Session">ba.Session</a> should look at the results and start
another <a href="#class_ba_Activity">ba.Activity</a>.</p>
</dd>
<dt><h4><a name="method_ba_Session__on_player_leave">on_player_leave()</a></dt></h4><dd>
<p><span>on_player_leave(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Called when a previously-accepted <a href="#class_ba_Player">ba.Player</a> leaves the session.</p>
</dd>
<dt><h4><a name="method_ba_Session__on_player_request">on_player_request()</a></dt></h4><dd>
<p><span>on_player_request(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; bool</span></p>
<p>Called when a new <a href="#class_ba_Player">ba.Player</a> wants to join the Session.</p>
<p>This should return True or False to accept/reject.</p>
</dd>
<dt><h4><a name="method_ba_Session__on_team_join">on_team_join()</a></dt></h4><dd>
<p><span>on_team_join(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; None</span></p>
<p>Called when a new <a href="#class_ba_Team">ba.Team</a> joins the session.</p>
</dd>
<dt><h4><a name="method_ba_Session__on_team_leave">on_team_leave()</a></dt></h4><dd>
<p><span>on_team_leave(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; None</span></p>
<p>Called when a <a href="#class_ba_Team">ba.Team</a> is leaving the session.</p>
</dd>
<dt><h4><a name="method_ba_Session__set_activity">set_activity()</a></dt></h4><dd>
<p><span>set_activity(self, activity: <a href="#class_ba_Activity">ba.Activity</a>) -&gt; None</span></p>
<p>Assign a new current <a href="#class_ba_Activity">ba.Activity</a> for the session.</p>
<p>Note that this will not change the current context to the new
Activity's. Code must be run in the new activity's methods
(on_transition_in, etc) to get it. (so you can't do
session.set_activity(foo) and then <a href="#function_ba_newnode">ba.newnode</a>() to add a node to foo)</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_SessionNotFoundError">ba.SessionNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_Session">ba.Session</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_ShouldShatterMessage">ba.ShouldShatterMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object that it should shatter.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a>
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_ShouldShatterMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.ShouldShatterMessage()</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Sound">ba.Sound</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A reference to a sound.</p>
<p>Category: <a href="#class_category_Asset_Classes">Asset Classes</a></p>
<p>Use <a href="#function_ba_getsound">ba.getsound</a>() to instantiate one.</p>
<hr>
<h2><strong><a name="class_ba_SpecialChar">ba.SpecialChar</a></strong></h3>
<p>inherits from: enum.Enum</p>
<p>Special characters the game can print.</p>
<p>Category: <a href="#class_category_Enums">Enums</a>
</p>
<h3>Values:</h3>
<ul>
<li>DOWN_ARROW</li>
<li>UP_ARROW</li>
<li>LEFT_ARROW</li>
<li>RIGHT_ARROW</li>
<li>TOP_BUTTON</li>
<li>LEFT_BUTTON</li>
<li>RIGHT_BUTTON</li>
<li>BOTTOM_BUTTON</li>
<li>DELETE</li>
<li>SHIFT</li>
<li>BACK</li>
<li>LOGO_FLAT</li>
<li>REWIND_BUTTON</li>
<li>PLAY_PAUSE_BUTTON</li>
<li>FAST_FORWARD_BUTTON</li>
<li>DPAD_CENTER_BUTTON</li>
<li>OUYA_BUTTON_O</li>
<li>OUYA_BUTTON_U</li>
<li>OUYA_BUTTON_Y</li>
<li>OUYA_BUTTON_A</li>
<li>OUYA_LOGO</li>
<li>LOGO</li>
<li>TICKET</li>
<li>GOOGLE_PLAY_GAMES_LOGO</li>
<li>GAME_CENTER_LOGO</li>
<li>DICE_BUTTON1</li>
<li>DICE_BUTTON2</li>
<li>DICE_BUTTON3</li>
<li>DICE_BUTTON4</li>
<li>GAME_CIRCLE_LOGO</li>
<li>PARTY_ICON</li>
<li>TEST_ACCOUNT</li>
<li>TICKET_BACKING</li>
<li>TROPHY1</li>
<li>TROPHY2</li>
<li>TROPHY3</li>
<li>TROPHY0A</li>
<li>TROPHY0B</li>
<li>TROPHY4</li>
<li>LOCAL_ACCOUNT</li>
<li>ALIBABA_LOGO</li>
<li>FLAG_UNITED_STATES</li>
<li>FLAG_MEXICO</li>
<li>FLAG_GERMANY</li>
<li>FLAG_BRAZIL</li>
<li>FLAG_RUSSIA</li>
<li>FLAG_CHINA</li>
<li>FLAG_UNITED_KINGDOM</li>
<li>FLAG_CANADA</li>
<li>FLAG_INDIA</li>
<li>FLAG_JAPAN</li>
<li>FLAG_FRANCE</li>
<li>FLAG_INDONESIA</li>
<li>FLAG_ITALY</li>
<li>FLAG_SOUTH_KOREA</li>
<li>FLAG_NETHERLANDS</li>
<li>FEDORA</li>
<li>HAL</li>
<li>CROWN</li>
<li>YIN_YANG</li>
<li>EYE_BALL</li>
<li>SKULL</li>
<li>HEART</li>
<li>DRAGON</li>
<li>HELMET</li>
<li>MUSHROOM</li>
<li>NINJA_STAR</li>
<li>VIKING_HELMET</li>
<li>MOON</li>
<li>SPIDER</li>
<li>FIREBALL</li>
<li>FLAG_UNITED_ARAB_EMIRATES</li>
<li>FLAG_QATAR</li>
<li>FLAG_EGYPT</li>
<li>FLAG_KUWAIT</li>
<li>FLAG_ALGERIA</li>
<li>FLAG_SAUDI_ARABIA</li>
<li>FLAG_MALAYSIA</li>
<li>FLAG_CZECH_REPUBLIC</li>
<li>FLAG_AUSTRALIA</li>
<li>FLAG_SINGAPORE</li>
<li>OCULUS_LOGO</li>
<li>STEAM_LOGO</li>
<li>NVIDIA_LOGO</li>
<li>FLAG_IRAN</li>
<li>FLAG_POLAND</li>
<li>FLAG_ARGENTINA</li>
<li>FLAG_PHILIPPINES</li>
<li>FLAG_CHILE</li>
<li>MIKIROG</li>
</ul>
<hr>
<h2><strong><a name="class_ba_StandMessage">ba.StandMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A message telling an object to move to a position in space.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a></p>
<p> Used when teleporting players to home base, etc.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_StandMessage__angle">angle</a>, <a href="#attr_ba_StandMessage__position">position</a></h5>
<dl>
<dt><h4><a name="attr_ba_StandMessage__angle">angle</a></h4></dt><dd>
<p><span>float</span></p>
<p>The angle to face (in degrees)</p>
</dd>
<dt><h4><a name="attr_ba_StandMessage__position">position</a></h4></dt><dd>
<p><span>Sequence[float]</span></p>
<p>Where to move to.</p>
</dd>
</dl>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_StandMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.StandMessage(position: Sequence[float] = (0.0, 0.0, 0.0), angle: float = 0.0)</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Stats">ba.Stats</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Manages scores and statistics for a <a href="#class_ba_Session">ba.Session</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_Stats____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Stats__get_records">get_records()</a>, <a href="#method_ba_Stats__getactivity">getactivity()</a>, <a href="#method_ba_Stats__player_got_hit">player_got_hit()</a>, <a href="#method_ba_Stats__player_scored">player_scored()</a>, <a href="#method_ba_Stats__player_was_killed">player_was_killed()</a>, <a href="#method_ba_Stats__register_player">register_player()</a>, <a href="#method_ba_Stats__reset">reset()</a>, <a href="#method_ba_Stats__reset_accum">reset_accum()</a>, <a href="#method_ba_Stats__set_activity">set_activity()</a></h5>
<dl>
<dt><h4><a name="method_ba_Stats____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Stats()</span></p>
</dd>
<dt><h4><a name="method_ba_Stats__get_records">get_records()</a></dt></h4><dd>
<p><span>get_records(self) -&gt; Dict[str, <a href="#class_ba_PlayerRecord">ba.PlayerRecord</a>]</span></p>
<p>Get PlayerRecord corresponding to still-existing players.</p>
</dd>
<dt><h4><a name="method_ba_Stats__getactivity">getactivity()</a></dt></h4><dd>
<p><span>getactivity(self) -&gt; Optional[<a href="#class_ba_Activity">ba.Activity</a>]</span></p>
<p>Get the activity associated with this instance.</p>
<p>May return None.</p>
</dd>
<dt><h4><a name="method_ba_Stats__player_got_hit">player_got_hit()</a></dt></h4><dd>
<p><span>player_got_hit(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Call this when a player got hit.</p>
</dd>
<dt><h4><a name="method_ba_Stats__player_scored">player_scored()</a></dt></h4><dd>
<p><span>player_scored(self, player: <a href="#class_ba_Player">ba.Player</a>, base_points: int = 1, target: Sequence[float] = None, kill: bool = False, victim_player: <a href="#class_ba_Player">ba.Player</a> = None, scale: float = 1.0, color: Sequence[float] = None, title: Union[str, <a href="#class_ba_Lstr">ba.Lstr</a>] = None, screenmessage: bool = True, display: bool = True, importance: int = 1, showpoints: bool = True, big_message: bool = False) -&gt; int</span></p>
<p>Register a score for the player.</p>
<p>Return value is actual score with multipliers and such factored in.</p>
</dd>
<dt><h4><a name="method_ba_Stats__player_was_killed">player_was_killed()</a></dt></h4><dd>
<p><span>player_was_killed(self, player: <a href="#class_ba_Player">ba.Player</a>, killed: bool = False, killer: <a href="#class_ba_Player">ba.Player</a> = None) -&gt; None</span></p>
<p>Should be called when a player is killed.</p>
</dd>
<dt><h4><a name="method_ba_Stats__register_player">register_player()</a></dt></h4><dd>
<p><span>register_player(self, player: <a href="#class_ba_Player">ba.Player</a>) -&gt; None</span></p>
<p>Register a player with this score-set.</p>
</dd>
<dt><h4><a name="method_ba_Stats__reset">reset()</a></dt></h4><dd>
<p><span>reset(self) -&gt; None</span></p>
<p>Reset the stats instance completely.</p>
</dd>
<dt><h4><a name="method_ba_Stats__reset_accum">reset_accum()</a></dt></h4><dd>
<p><span>reset_accum(self) -&gt; None</span></p>
<p>Reset per-sound sub-scores.</p>
</dd>
<dt><h4><a name="method_ba_Stats__set_activity">set_activity()</a></dt></h4><dd>
<p><span>set_activity(self, activity: <a href="#class_ba_Activity">ba.Activity</a>) -&gt; None</span></p>
<p>Set the current activity for this instance.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Team">ba.Team</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A team of one or more <a href="#class_ba_Player">ba.Players</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> Note that a player *always* has a team;
in some cases, such as free-for-all <a href="#class_ba_Session">ba.Sessions</a>,
each team consists of just one <a href="#class_ba_Player">ba.Player</a>.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Team__color">color</a>, <a href="#attr_ba_Team__gamedata">gamedata</a>, <a href="#attr_ba_Team__name">name</a>, <a href="#attr_ba_Team__players">players</a>, <a href="#attr_ba_Team__sessiondata">sessiondata</a></h5>
<dl>
<dt><h4><a name="attr_ba_Team__color">color</a></h4></dt><dd>
<p><span>Tuple[float, ...]</span></p>
<p>The team's color.</p>
</dd>
<dt><h4><a name="attr_ba_Team__gamedata">gamedata</a></h4></dt><dd>
<p><span>Dict</span></p>
<p>A dict for use by the current <a href="#class_ba_Activity">ba.Activity</a>
for storing data associated with this team.
This gets cleared for each new <a href="#class_ba_Activity">ba.Activity</a>.</p>
</dd>
<dt><h4><a name="attr_ba_Team__name">name</a></h4></dt><dd>
<p><span>Union[<a href="#class_ba_Lstr">ba.Lstr</a>, str]</span></p>
<p>The team's name.</p>
</dd>
<dt><h4><a name="attr_ba_Team__players">players</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_Player">ba.Player</a>]</span></p>
<p>The list of <a href="#class_ba_Player">ba.Players</a> on the team.</p>
</dd>
<dt><h4><a name="attr_ba_Team__sessiondata">sessiondata</a></h4></dt><dd>
<p><span>Dict</span></p>
<p>A dict for use by the current <a href="#class_ba_Session">ba.Session</a> for
storing data associated with this team.
Unlike gamedata, this persists for the duration
of the session.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Team____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Team__get_id">get_id()</a></h5>
<dl>
<dt><h4><a name="method_ba_Team____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Team(team_id: 'int' = 0, name: 'Union[<a href="#class_ba_Lstr">ba.Lstr</a>, str]' = '', color: 'Sequence[float]' = (1.0, 1.0, 1.0))</span></p>
<p>Instantiate a ba.Team.</p>
<p>In most cases, all teams are provided to you by the <a href="#class_ba_Session">ba.Session</a>,
<a href="#class_ba_Session">ba.Session</a>, so calling this shouldn't be necessary.</p>
</dd>
<dt><h4><a name="method_ba_Team__get_id">get_id()</a></dt></h4><dd>
<p><span>get_id(self) -&gt; int</span></p>
<p>Returns the numeric team ID.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_TeamBaseSession">ba.TeamBaseSession</a></strong></h3>
<p>inherits from: <a href="#class_ba_Session">ba.Session</a></p>
<p>Common base class for <a href="#class_ba_TeamsSession">ba.TeamsSession</a> and <a href="#class_ba_FreeForAllSession">ba.FreeForAllSession</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> Free-for-all-mode is essentially just teams-mode with each <a href="#class_ba_Player">ba.Player</a> having
their own <a href="#class_ba_Team">ba.Team</a>, so there is much overlap in functionality.
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Session__campaign">campaign</a>, <a href="#attr_ba_Session__lobby">lobby</a>, <a href="#attr_ba_Session__max_players">max_players</a>, <a href="#attr_ba_Session__min_players">min_players</a>, <a href="#attr_ba_Session__players">players</a>, <a href="#attr_ba_Session__teams">teams</a></h5>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_Session__begin_next_activity">begin_next_activity()</a>, <a href="#method_ba_Session__end">end()</a>, <a href="#method_ba_Session__end_activity">end_activity()</a>, <a href="#method_ba_Session__get_custom_menu_entries">get_custom_menu_entries()</a>, <a href="#method_ba_Session__getactivity">getactivity()</a>, <a href="#method_ba_Session__handlemessage">handlemessage()</a>, <a href="#method_ba_Session__launch_end_session_activity">launch_end_session_activity()</a>, <a href="#method_ba_Session__on_player_leave">on_player_leave()</a>, <a href="#method_ba_Session__on_player_request">on_player_request()</a>, <a href="#method_ba_Session__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Session__set_activity">set_activity()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_TeamBaseSession____init__">&lt;constructor&gt;</a>, <a href="#method_ba_TeamBaseSession__announce_game_results">announce_game_results()</a>, <a href="#method_ba_TeamBaseSession__get_ffa_series_length">get_ffa_series_length()</a>, <a href="#method_ba_TeamBaseSession__get_game_number">get_game_number()</a>, <a href="#method_ba_TeamBaseSession__get_max_players">get_max_players()</a>, <a href="#method_ba_TeamBaseSession__get_next_game_description">get_next_game_description()</a>, <a href="#method_ba_TeamBaseSession__get_series_length">get_series_length()</a>, <a href="#method_ba_TeamBaseSession__on_activity_end">on_activity_end()</a>, <a href="#method_ba_TeamBaseSession__on_team_join">on_team_join()</a></h5>
<dl>
<dt><h4><a name="method_ba_TeamBaseSession____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.TeamBaseSession()</span></p>
<p>Set up playlists and launches a <a href="#class_ba_Activity">ba.Activity</a> to accept joiners.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__announce_game_results">announce_game_results()</a></dt></h4><dd>
<p><span>announce_game_results(self, activity: <a href="#class_ba_GameActivity">ba.GameActivity</a>, results: <a href="#class_ba_TeamGameResults">ba.TeamGameResults</a>, delay: float, announce_winning_team: bool = True) -&gt; None</span></p>
<p>Show basic game result at the end of a game.</p>
<p>(before transitioning to a score screen).
This will include a zoom-text of 'BLUE WINS'
or whatnot, along with a possible audio
announcement of the same.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__get_ffa_series_length">get_ffa_series_length()</a></dt></h4><dd>
<p><span>get_ffa_series_length(self) -&gt; int</span></p>
<p>Return free-for-all series length.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__get_game_number">get_game_number()</a></dt></h4><dd>
<p><span>get_game_number(self) -&gt; int</span></p>
<p>Returns which game in the series is currently being played.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__get_max_players">get_max_players()</a></dt></h4><dd>
<p><span>get_max_players(self) -&gt; int</span></p>
<p>Return max number of <a href="#class_ba_Player">ba.Players</a> allowed to join the game at once.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__get_next_game_description">get_next_game_description()</a></dt></h4><dd>
<p><span>get_next_game_description(self) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Returns a description of the next game on deck.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__get_series_length">get_series_length()</a></dt></h4><dd>
<p><span>get_series_length(self) -&gt; int</span></p>
<p>Return teams series length.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__on_activity_end">on_activity_end()</a></dt></h4><dd>
<p><span>on_activity_end(self, activity: <a href="#class_ba_Activity">ba.Activity</a>, results: Any) -&gt; None</span></p>
<p>Called when the current <a href="#class_ba_Activity">ba.Activity</a> has ended.</p>
<p>The <a href="#class_ba_Session">ba.Session</a> should look at the results and start
another <a href="#class_ba_Activity">ba.Activity</a>.</p>
</dd>
<dt><h4><a name="method_ba_TeamBaseSession__on_team_join">on_team_join()</a></dt></h4><dd>
<p><span>on_team_join(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; None</span></p>
<p>Called when a new <a href="#class_ba_Team">ba.Team</a> joins the session.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_TeamGameActivity">ba.TeamGameActivity</a></strong></h3>
<p>inherits from: <a href="#class_ba_GameActivity">ba.GameActivity</a>, <a href="#class_ba_Activity">ba.Activity</a>, <a href="#class_ba_DependencyComponent">ba.DependencyComponent</a></p>
<p>Base class for teams and free-for-all mode games.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> (Free-for-all is essentially just a special case where every
<a href="#class_ba_Player">ba.Player</a> has their own <a href="#class_ba_Team">ba.Team</a>)
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Activity__players">players</a>, <a href="#attr_ba_Activity__settings">settings</a>, <a href="#attr_ba_Activity__teams">teams</a></h5>
<h3>Attributes Defined Here:</h3>
<h5><a href="#attr_ba_TeamGameActivity__map">map</a>, <a href="#attr_ba_TeamGameActivity__session">session</a>, <a href="#attr_ba_TeamGameActivity__stats">stats</a></h5>
<dl>
<dt><h4><a name="attr_ba_TeamGameActivity__map">map</a></h4></dt><dd>
<p><span><a href="#class_ba_Map">ba.Map</a></span></p>
<p>The map being used for this game.</p>
<p> Raises a <a href="#class_ba_NotFoundError">ba.NotFoundError</a> if the map does not currently exist.</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameActivity__session">session</a></h4></dt><dd>
<p><span><a href="#class_ba_Session">ba.Session</a></span></p>
<p>The <a href="#class_ba_Session">ba.Session</a> this <a href="#class_ba_Activity">ba.Activity</a> belongs go.</p>
<p> Raises a <a href="#class_ba_SessionNotFoundError">ba.SessionNotFoundError</a> if the Session no longer exists.</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameActivity__stats">stats</a></h4></dt><dd>
<p><span><a href="#class_ba_Stats">ba.Stats</a></span></p>
<p>The stats instance accessible while the activity is running.</p>
<p> If access is attempted before or after, raises a <a href="#class_ba_NotFoundError">ba.NotFoundError</a>.</p>
</dd>
</dl>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_GameActivity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_GameActivity__begin">begin()</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__create_player_node">create_player_node()</a>, <a href="#method_ba_GameActivity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_resolved_score_info">get_resolved_score_info()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_settings">get_settings()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__has_begun">has_begun()</a>, <a href="#method_ba_GameActivity__has_ended">has_ended()</a>, <a href="#method_ba_GameActivity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_GameActivity__is_expired">is_expired()</a>, <a href="#method_ba_GameActivity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_expire">on_expire()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_team_join">on_team_join()</a>, <a href="#method_ba_GameActivity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_GameActivity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__retain_actor">retain_actor()</a>, <a href="#method_ba_GameActivity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_GameActivity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__start_transition_in">start_transition_in()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_TeamGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_TeamGameActivity__end">end()</a>, <a href="#method_ba_TeamGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_TeamGameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_TeamGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_TeamGameActivity__supports_session_type">supports_session_type()</a></h5>
<dl>
<dt><h4><a name="method_ba_TeamGameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.TeamGameActivity(settings: Dict[str, Any])</span></p>
<p>Instantiate the Activity.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameActivity__end">end()</a></dt></h4><dd>
<p><span>end(self, results: Any = None, announce_winning_team: bool = True, announce_delay: float = 0.1, force: bool = False) -&gt; None</span></p>
<p>End the game and announce the single winning team
unless 'announce_winning_team' is False.
(for results without a single most-important winner).</p>
</dd>
<dt><h4><a name="method_ba_TeamGameActivity__on_begin">on_begin()</a></dt></h4><dd>
<p><span>on_begin(self) -&gt; None</span></p>
<p>Called once the previous <a href="#class_ba_Activity">ba.Activity</a> has finished transitioning out.</p>
<p>At this point the activity's initial players and teams are filled in
and it should begin its actual game logic.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameActivity__on_transition_in">on_transition_in()</a></dt></h4><dd>
<p><span>on_transition_in(self) -&gt; None</span></p>
<p>Called when the Activity is first becoming visible.</p>
<p>Upon this call, the Activity should fade in backgrounds,
start playing music, etc. It does not yet have access to <a href="#class_ba_Player">ba.Players</a>
or <a href="#class_ba_Team">ba.Teams</a>, however. They remain owned by the previous Activity
up until <a href="#method_ba_Activity__on_begin">ba.Activity.on_begin</a>() is called.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameActivity__spawn_player_spaz">spawn_player_spaz()</a></dt></h4><dd>
<p><span>spawn_player_spaz(self, player: <a href="#class_ba_Player">ba.Player</a>, position: Sequence[float] = None, angle: float = None) -&gt; PlayerSpaz</span></p>
<p>Method override; spawns and wires up a standard ba.PlayerSpaz for
a <a href="#class_ba_Player">ba.Player</a>.</p>
<p>If position or angle is not supplied, a default will be chosen based
on the <a href="#class_ba_Player">ba.Player</a> and their <a href="#class_ba_Team">ba.Team</a>.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameActivity__supports_session_type">supports_session_type()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>supports_session_type(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; bool </span></p>
<p>Class method override;
returns True for <a href="#class_ba_TeamsSession">ba.TeamsSessions</a> and <a href="#class_ba_FreeForAllSession">ba.FreeForAllSessions</a>;
False otherwise.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_TeamGameResults">ba.TeamGameResults</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>
Results for a completed <a href="#class_ba_TeamGameActivity">ba.TeamGameActivity</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p>Upon completion, a game should fill one of these out and pass it to its
<a href="#method_ba_Activity__end">ba.Activity.end</a>() call.</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_TeamGameResults____init__">&lt;constructor&gt;</a>, <a href="#method_ba_TeamGameResults__get_lower_is_better">get_lower_is_better()</a>, <a href="#method_ba_TeamGameResults__get_player_info">get_player_info()</a>, <a href="#method_ba_TeamGameResults__get_score_name">get_score_name()</a>, <a href="#method_ba_TeamGameResults__get_score_type">get_score_type()</a>, <a href="#method_ba_TeamGameResults__get_team_score">get_team_score()</a>, <a href="#method_ba_TeamGameResults__get_team_score_str">get_team_score_str()</a>, <a href="#method_ba_TeamGameResults__get_teams">get_teams()</a>, <a href="#method_ba_TeamGameResults__get_winners">get_winners()</a>, <a href="#method_ba_TeamGameResults__get_winning_team">get_winning_team()</a>, <a href="#method_ba_TeamGameResults__has_score_for_team">has_score_for_team()</a>, <a href="#method_ba_TeamGameResults__set_game">set_game()</a>, <a href="#method_ba_TeamGameResults__set_team_score">set_team_score()</a></h5>
<dl>
<dt><h4><a name="method_ba_TeamGameResults____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.TeamGameResults()</span></p>
<p>Instantiate a results instance.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_lower_is_better">get_lower_is_better()</a></dt></h4><dd>
<p><span>get_lower_is_better(self) -&gt; bool</span></p>
<p>Return whether lower scores are better.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_player_info">get_player_info()</a></dt></h4><dd>
<p><span>get_player_info(self) -&gt; List[Dict[str, Any]]</span></p>
<p>Get info about the players represented by the results.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_score_name">get_score_name()</a></dt></h4><dd>
<p><span>get_score_name(self) -&gt; str</span></p>
<p>Get the name associated with scores ('points', etc).</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_score_type">get_score_type()</a></dt></h4><dd>
<p><span>get_score_type(self) -&gt; str</span></p>
<p>Get the type of score.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_team_score">get_team_score()</a></dt></h4><dd>
<p><span>get_team_score(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; Optional[int]</span></p>
<p>Return the score for a given team.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_team_score_str">get_team_score_str()</a></dt></h4><dd>
<p><span>get_team_score_str(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return the score for the given <a href="#class_ba_Team">ba.Team</a> as an Lstr.</p>
<p>(properly formatted for the score type.)</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_teams">get_teams()</a></dt></h4><dd>
<p><span>get_teams(self) -&gt; List[<a href="#class_ba_Team">ba.Team</a>]</span></p>
<p>Return all <a href="#class_ba_Team">ba.Teams</a> in the results.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_winners">get_winners()</a></dt></h4><dd>
<p><span>get_winners(self) -&gt; List[WinnerGroup]</span></p>
<p>Get an ordered list of winner groups.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_winning_team">get_winning_team()</a></dt></h4><dd>
<p><span>get_winning_team(self) -&gt; Optional[<a href="#class_ba_Team">ba.Team</a>]</span></p>
<p>Get the winning <a href="#class_ba_Team">ba.Team</a> if there is exactly one; None otherwise.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__has_score_for_team">has_score_for_team()</a></dt></h4><dd>
<p><span>has_score_for_team(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; bool</span></p>
<p>Return whether there is a score for a given team.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__set_game">set_game()</a></dt></h4><dd>
<p><span>set_game(self, game: <a href="#class_ba_GameActivity">ba.GameActivity</a>) -&gt; None</span></p>
<p>Set the game instance these results are applying to.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__set_team_score">set_team_score()</a></dt></h4><dd>
<p><span>set_team_score(self, team: <a href="#class_ba_Team">ba.Team</a>, score: int) -&gt; None</span></p>
<p>Set the score for a given <a href="#class_ba_Team">ba.Team</a>.</p>
<p>This can be a number or None.
(see the none_is_winner arg in the constructor)</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_TeamNotFoundError">ba.TeamNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_Team">ba.Team</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_TeamsSession">ba.TeamsSession</a></strong></h3>
<p>inherits from: <a href="#class_ba_TeamBaseSession">ba.TeamBaseSession</a>, <a href="#class_ba_Session">ba.Session</a></p>
<p><a href="#class_ba_Session">ba.Session</a> type for teams mode games.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a>
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Session__campaign">campaign</a>, <a href="#attr_ba_Session__lobby">lobby</a>, <a href="#attr_ba_Session__max_players">max_players</a>, <a href="#attr_ba_Session__min_players">min_players</a>, <a href="#attr_ba_Session__players">players</a>, <a href="#attr_ba_Session__teams">teams</a></h5>
<h3>Methods Inherited:</h3>
<h5><a href="#method_ba_TeamBaseSession__announce_game_results">announce_game_results()</a>, <a href="#method_ba_TeamBaseSession__begin_next_activity">begin_next_activity()</a>, <a href="#method_ba_TeamBaseSession__end">end()</a>, <a href="#method_ba_TeamBaseSession__end_activity">end_activity()</a>, <a href="#method_ba_TeamBaseSession__get_custom_menu_entries">get_custom_menu_entries()</a>, <a href="#method_ba_TeamBaseSession__get_ffa_series_length">get_ffa_series_length()</a>, <a href="#method_ba_TeamBaseSession__get_game_number">get_game_number()</a>, <a href="#method_ba_TeamBaseSession__get_max_players">get_max_players()</a>, <a href="#method_ba_TeamBaseSession__get_next_game_description">get_next_game_description()</a>, <a href="#method_ba_TeamBaseSession__get_series_length">get_series_length()</a>, <a href="#method_ba_TeamBaseSession__getactivity">getactivity()</a>, <a href="#method_ba_TeamBaseSession__handlemessage">handlemessage()</a>, <a href="#method_ba_TeamBaseSession__launch_end_session_activity">launch_end_session_activity()</a>, <a href="#method_ba_TeamBaseSession__on_activity_end">on_activity_end()</a>, <a href="#method_ba_TeamBaseSession__on_player_leave">on_player_leave()</a>, <a href="#method_ba_TeamBaseSession__on_player_request">on_player_request()</a>, <a href="#method_ba_TeamBaseSession__on_team_join">on_team_join()</a>, <a href="#method_ba_TeamBaseSession__on_team_leave">on_team_leave()</a>, <a href="#method_ba_TeamBaseSession__set_activity">set_activity()</a></h5>
<h3>Methods Defined or Overridden:</h3>
<dl>
<dt><h4><a name="method_ba_TeamsSession____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.TeamsSession()</span></p>
<p>Set up playlists and launches a <a href="#class_ba_Activity">ba.Activity</a> to accept joiners.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Texture">ba.Texture</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A reference to a texture.</p>
<p>Category: <a href="#class_category_Asset_Classes">Asset Classes</a></p>
<p>Use <a href="#function_ba_gettexture">ba.gettexture</a>() to instantiate one.</p>
<hr>
<h2><strong><a name="class_ba_ThawMessage">ba.ThawMessage</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Tells an object to stop being frozen.</p>
<p>Category: <a href="#class_category_Message_Classes">Message Classes</a>
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_ThawMessage____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.ThawMessage()</span></p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_TimeFormat">ba.TimeFormat</a></strong></h3>
<p>inherits from: enum.Enum</p>
<p>Specifies the format time values are provided in.</p>
<p>Category: <a href="#class_category_Enums">Enums</a>
</p>
<h3>Values:</h3>
<ul>
<li>SECONDS</li>
<li>MILLISECONDS</li>
</ul>
<hr>
<h2><strong><a name="class_ba_Timer">ba.Timer</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Timer(time: float, call: Callable[[], Any], repeat: bool = False,
timetype: <a href="#class_ba_TimeType">ba.TimeType</a> = TimeType.SIM,
timeformat: <a href="#class_ba_TimeFormat">ba.TimeFormat</a> = TimeFormat.SECONDS,
suppress_format_warning: bool = False)</p>
<p>Timers are used to run code at later points in time.</p>
<p>Category: <a href="#class_category_General_Utility_Classes">General Utility Classes</a></p>
<p>This class encapsulates a timer in the current <a href="#class_ba_Context">ba.Context</a>.
The underlying timer will be destroyed when either this object is
no longer referenced or when its Context (Activity, etc.) dies. If you
do not want to worry about keeping a reference to your timer around,
you should use the <a href="#function_ba_timer">ba.timer</a>() function instead.</p>
<p>time: length of time (in seconds by default) that the timer will wait
before firing. Note that the actual delay experienced may vary
depending on the timetype. (see below)</p>
<p>call: A callable Python object. Note that the timer will retain a
strong reference to the callable for as long as it exists, so you
may want to look into concepts such as <a href="#class_ba_WeakCall">ba.WeakCall</a> if that is not
desired.</p>
<p>repeat: if True, the timer will fire repeatedly, with each successive
firing having the same delay as the first.</p>
<p>timetype can be either 'sim', 'base', or 'real'. It defaults to
'sim'. Types are explained below:</p>
<p>'sim' time maps to local simulation time in <a href="#class_ba_Activity">ba.Activity</a> or <a href="#class_ba_Session">ba.Session</a>
Contexts. This means that it may progress slower in slow-motion play
modes, stop when the game is paused, etc. This time type is not
available in UI contexts.</p>
<p>'base' time is also linked to gameplay in <a href="#class_ba_Activity">ba.Activity</a> or <a href="#class_ba_Session">ba.Session</a>
Contexts, but it progresses at a constant rate regardless of
slow-motion states or pausing. It can, however, slow down or stop
in certain cases such as network outages or game slowdowns due to
cpu load. Like 'sim' time, this is unavailable in UI contexts.</p>
<p>'real' time always maps to actual clock time with a bit of filtering
added, regardless of Context. (the filtering prevents it from going
backwards or jumping forward by large amounts due to the app being
backgrounded, system time changing, etc.)
Real time timers are currently only available in the UI context.</p>
<p>the 'timeformat' arg defaults to SECONDS but can also be MILLISECONDS
if you want to pass time as milliseconds.</p>
<pre><span><em><small># Example: use a Timer object to print repeatedly for a few seconds:</small></em></span>
def say_it():
<a href="#function_ba_screenmessage">ba.screenmessage</a>('BADGER!')
def stop_saying_it():
self.t = None
<a href="#function_ba_screenmessage">ba.screenmessage</a>('MUSHROOM MUSHROOM!')
<span><em><small># create our timer; it will run as long as we hold self.t</small></em></span>
self.t = <a href="#class_ba_Timer">ba.Timer</a>(0.3, say_it, repeat=True)
<span><em><small># now fire off a one-shot timer to kill it</small></em></span>
<a href="#function_ba_timer">ba.timer</a>(3.89, stop_saying_it)</pre>
<hr>
<h2><strong><a name="class_ba_TimeType">ba.TimeType</a></strong></h3>
<p>inherits from: enum.Enum</p>
<p>Specifies the type of time for various operations to target/use.</p>
<p>Category: <a href="#class_category_Enums">Enums</a></p>
<p> 'sim' time is the local simulation time for an activity or session.
It can proceed at different rates depending on game speed, stops
for pauses, etc.</p>
<p> 'base' is the baseline time for an activity or session. It proceeds
consistently regardless of game speed or pausing, but may stop during
occurrences such as network outages.</p>
<p> 'real' time is mostly based on clock time, with a few exceptions. It may
not advance while the app is backgrounded for instance. (the engine
attempts to prevent single large time jumps from occurring)
</p>
<h3>Values:</h3>
<ul>
<li>SIM</li>
<li>BASE</li>
<li>REAL</li>
</ul>
<hr>
<h2><strong><a name="class_ba_UIController">ba.UIController</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Wrangles UILocations.</p>
<p>Category: <a href="#class_category_User_Interface_Classes">User Interface Classes</a>
</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_UIController____init__">&lt;constructor&gt;</a>, <a href="#method_ba_UIController__show_main_menu">show_main_menu()</a></h5>
<dl>
<dt><h4><a name="method_ba_UIController____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.UIController()</span></p>
</dd>
<dt><h4><a name="method_ba_UIController__show_main_menu">show_main_menu()</a></dt></h4><dd>
<p><span>show_main_menu(self, in_game: bool = True) -&gt; None</span></p>
<p>Show the main menu, clearing other UIs from location stacks.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Vec3">ba.Vec3</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A vector of 3 floats.</p>
<p>Category: <a href="#class_category_General_Utility_Classes">General Utility Classes</a></p>
<p>These can be created the following ways (checked in this order):
- with no args, all values are set to 0
- with a single numeric arg, all values are set to that value
- with a single three-member sequence arg, sequence values are copied
- otherwise assumes individual x/y/z args (positional or keywords)</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_Vec3__x">x</a>, <a href="#attr_ba_Vec3__y">y</a>, <a href="#attr_ba_Vec3__z">z</a></h5>
<dl>
<dt><h4><a name="attr_ba_Vec3__x">x</a></h4></dt><dd>
<p><span> float</span></p>
<p>The vector's X component.</p>
</dd>
<dt><h4><a name="attr_ba_Vec3__y">y</a></h4></dt><dd>
<p><span> float</span></p>
<p>The vector's Y component.</p>
</dd>
<dt><h4><a name="attr_ba_Vec3__z">z</a></h4></dt><dd>
<p><span> float</span></p>
<p>The vector's Z component.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_Vec3__cross">cross()</a>, <a href="#method_ba_Vec3__dot">dot()</a>, <a href="#method_ba_Vec3__length">length()</a>, <a href="#method_ba_Vec3__normalized">normalized()</a></h5>
<dl>
<dt><h4><a name="method_ba_Vec3__cross">cross()</a></dt></h4><dd>
<p><span>cross(other: Vec3) -&gt; Vec3</span></p>
<p>Returns the cross product of this vector and another.</p>
</dd>
<dt><h4><a name="method_ba_Vec3__dot">dot()</a></dt></h4><dd>
<p><span>dot(other: Vec3) -&gt; float</span></p>
<p>Returns the dot product of this vector and another.</p>
</dd>
<dt><h4><a name="method_ba_Vec3__length">length()</a></dt></h4><dd>
<p><span>length() -&gt; float</span></p>
<p>Returns the length of the vector.</p>
</dd>
<dt><h4><a name="method_ba_Vec3__normalized">normalized()</a></dt></h4><dd>
<p><span>normalized() -&gt; Vec3</span></p>
<p>Returns a normalized version of the vector.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_WeakCall">ba.WeakCall</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Wrap a callable and arguments into a single callable object.</p>
<p>Category: <a href="#class_category_General_Utility_Classes">General Utility Classes</a></p>
<p> When passed a bound method as the callable, the instance portion
of it is weak-referenced, meaning the underlying instance is
free to die if all other references to it go away. Should this
occur, calling the WeakCall is simply a no-op.</p>
<p> Think of this as a handy way to tell an object to do something
at some point in the future if it happens to still exist.</p>
<pre><span><em><small> # EXAMPLE A: this code will create a FooClass instance and call its</small></em></span>
<span><em><small> # bar() method 5 seconds later; it will be kept alive even though</small></em></span>
<span><em><small> # we overwrite its variable with None because the bound method</small></em></span>
<span><em><small> # we pass as a timer callback (foo.bar) strong-references it</small></em></span>
foo = FooClass()
<a href="#function_ba_timer">ba.timer</a>(5.0, foo.bar)
foo = None</pre>
<pre><span><em><small> # EXAMPLE B: this code will *not* keep our object alive; it will die</small></em></span>
<span><em><small> # when we overwrite it with None and the timer will be a no-op when it</small></em></span>
<span><em><small> # fires</small></em></span>
foo = FooClass()
<a href="#function_ba_timer">ba.timer</a>(5.0, <a href="#class_ba_WeakCall">ba.WeakCall</a>(foo.bar))
foo = None</pre>
<p> Note: additional args and keywords you provide to the WeakCall()
constructor are stored as regular strong-references; you'll need
to wrap them in weakrefs manually if desired.
</p>
<h3>Methods:</h3>
<dl>
<dt><h4><a name="method_ba_WeakCall____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.WeakCall(*args: Any, **keywds: Any)</span></p>
<p>Instantiate a WeakCall; pass a callable as the first
arg, followed by any number of arguments or keywords.</p>
<pre><span><em><small># Example: wrap a method call with some positional and</small></em></span>
<span><em><small># keyword args:</small></em></span>
myweakcall = ba.WeakCall(myobj.dostuff, argval1, namedarg=argval2)</pre>
<pre><span><em><small># Now we have a single callable to run that whole mess.</small></em></span>
<span><em><small># The same as calling myobj.dostuff(argval1, namedarg=argval2)</small></em></span>
<span><em><small># (provided my_obj still exists; this will do nothing otherwise)</small></em></span>
myweakcall()</pre>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_Widget">ba.Widget</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>Internal type for low level UI elements; buttons, windows, etc.</p>
<p>Category: <a href="#class_category_User_Interface_Classes">User Interface Classes</a></p>
<p>This class represents a weak reference to a widget object
in the internal c++ layer. Currently, functions such as
<a href="#function_ba_buttonwidget">ba.buttonwidget</a>() must be used to instantiate or edit these.</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_Widget__activate">activate()</a>, <a href="#method_ba_Widget__add_delete_callback">add_delete_callback()</a>, <a href="#method_ba_Widget__delete">delete()</a>, <a href="#method_ba_Widget__exists">exists()</a>, <a href="#method_ba_Widget__get_children">get_children()</a>, <a href="#method_ba_Widget__get_screen_space_center">get_screen_space_center()</a>, <a href="#method_ba_Widget__get_selected_child">get_selected_child()</a>, <a href="#method_ba_Widget__get_widget_type">get_widget_type()</a></h5>
<dl>
<dt><h4><a name="method_ba_Widget__activate">activate()</a></dt></h4><dd>
<p><span>activate() -&gt; None</span></p>
<p>Activates a widget; the same as if it had been clicked.</p>
</dd>
<dt><h4><a name="method_ba_Widget__add_delete_callback">add_delete_callback()</a></dt></h4><dd>
<p><span>add_delete_callback(call: Callable) -&gt; None</span></p>
<p>Add a call to be run immediately after this widget is destroyed.</p>
</dd>
<dt><h4><a name="method_ba_Widget__delete">delete()</a></dt></h4><dd>
<p><span>delete(ignore_missing: bool = True) -&gt; None</span></p>
<p>Delete the Widget. Ignores already-deleted Widgets if ignore_missing
is True; otherwise an Exception is thrown.</p>
</dd>
<dt><h4><a name="method_ba_Widget__exists">exists()</a></dt></h4><dd>
<p><span>exists() -&gt; bool</span></p>
<p>Returns whether the Widget still exists.
Most functionality will fail on a nonexistent widget.</p>
<p>Note that you can also use the boolean operator for this same
functionality, so a statement such as "if mywidget" will do
the right thing both for Widget objects and values of None.</p>
</dd>
<dt><h4><a name="method_ba_Widget__get_children">get_children()</a></dt></h4><dd>
<p><span>get_children() -&gt; List[<a href="#class_ba_Widget">ba.Widget</a>]</span></p>
<p>Returns any child Widgets of this Widget.</p>
</dd>
<dt><h4><a name="method_ba_Widget__get_screen_space_center">get_screen_space_center()</a></dt></h4><dd>
<p><span>get_screen_space_center() -&gt; Tuple[float, float]</span></p>
<p>Returns the coords of the Widget center relative to the center of the
screen. This can be useful for placing pop-up windows and other special
cases.</p>
</dd>
<dt><h4><a name="method_ba_Widget__get_selected_child">get_selected_child()</a></dt></h4><dd>
<p><span>get_selected_child() -&gt; Optional[<a href="#class_ba_Widget">ba.Widget</a>]</span></p>
<p>Returns the selected child Widget or None if nothing is selected.</p>
</dd>
<dt><h4><a name="method_ba_Widget__get_widget_type">get_widget_type()</a></dt></h4><dd>
<p><span>get_widget_type() -&gt; str</span></p>
<p>Return the internal type of the Widget as a string. Note that this is
different from the Python <a href="#class_ba_Widget">ba.Widget</a> type, which is the same for all
widgets.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_WidgetNotFoundError">ba.WidgetNotFoundError</a></strong></h3>
<p>inherits from: <a href="#class_ba_NotFoundError">ba.NotFoundError</a>, Exception, BaseException</p>
<p>Exception raised when an expected <a href="#class_ba_Widget">ba.Widget</a> does not exist.</p>
<p>Category: <a href="#class_category_Exception_Classes">Exception Classes</a>
</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_Window">ba.Window</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>A basic window.</p>
<p>Category: <a href="#class_category_User_Interface_Classes">User Interface Classes</a>
</p>
<h3>Methods:</h3>
<h5><a href="#method_ba_Window____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Window__get_root_widget">get_root_widget()</a></h5>
<dl>
<dt><h4><a name="method_ba_Window____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Window(root_widget: <a href="#class_ba_Widget">ba.Widget</a>)</span></p>
</dd>
<dt><h4><a name="method_ba_Window__get_root_widget">get_root_widget()</a></dt></h4><dd>
<p><span>get_root_widget(self) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Return the root widget.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="function_ba_animate">ba.animate()</a></strong></h3>
<p><span>animate(node: <a href="#class_ba_Node">ba.Node</a>, attr: str, keys: Dict[float, float], loop: bool = False, offset: float = 0, timetype: <a href="#class_ba_TimeType">ba.TimeType</a> = &lt;TimeType.SIM: 0&gt;, timeformat: <a href="#class_ba_TimeFormat">ba.TimeFormat</a> = &lt;TimeFormat.SECONDS: 0&gt;, suppress_format_warning: bool = False) -&gt; <a href="#class_ba_Node">ba.Node</a></span></p>
<p>Animate values on a target <a href="#class_ba_Node">ba.Node</a>.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>Creates an 'animcurve' node with the provided values and time as an input,
connect it to the provided attribute, and set it to die with the target.
Key values are provided as time:value dictionary pairs. Time values are
relative to the current time. By default, times are specified in seconds,
but timeformat can also be set to MILLISECONDS to recreate the old behavior
(prior to ba 1.5) of taking milliseconds. Returns the animcurve node.</p>
<hr>
<h2><strong><a name="function_ba_animate_array">ba.animate_array()</a></strong></h3>
<p><span>animate_array(node: <a href="#class_ba_Node">ba.Node</a>, attr: str, size: int, keys: Dict[float, Sequence[float]], loop: bool = False, offset: float = 0, timetype: <a href="#class_ba_TimeType">ba.TimeType</a> = &lt;TimeType.SIM: 0&gt;, timeformat: <a href="#class_ba_TimeFormat">ba.TimeFormat</a> = &lt;TimeFormat.SECONDS: 0&gt;, suppress_format_warning: bool = False) -&gt; None</span></p>
<p>Animate an array of values on a target <a href="#class_ba_Node">ba.Node</a>.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>Like <a href="#function_ba_animate">ba.animate</a>(), but operates on array attributes.</p>
<hr>
<h2><strong><a name="function_ba_buttonwidget">ba.buttonwidget()</a></strong></h3>
<p><span>buttonwidget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None,
parent: <a href="#class_ba_Widget">ba.Widget</a> = None,
size: Sequence[float] = None,
position: Sequence[float] = None,
on_activate_call: Callable = None,
label: Union[str, <a href="#class_ba_Lstr">ba.Lstr</a>] = None,
color: Sequence[float] = None,
down_widget: <a href="#class_ba_Widget">ba.Widget</a> = None,
up_widget: <a href="#class_ba_Widget">ba.Widget</a> = None,
left_widget: <a href="#class_ba_Widget">ba.Widget</a> = None,
right_widget: <a href="#class_ba_Widget">ba.Widget</a> = None,
texture: <a href="#class_ba_Texture">ba.Texture</a> = None,
text_scale: float = None,
textcolor: Sequence[float] = None,
enable_sound: bool = None,
model_transparent: <a href="#class_ba_Model">ba.Model</a> = None,
model_opaque: <a href="#class_ba_Model">ba.Model</a> = None,
repeat: bool = None,
scale: float = None,
transition_delay: float = None,
on_select_call: Callable = None,
button_type: str = None,
extra_touch_border_scale: float = None,
selectable: bool = None,
show_buffer_top: float = None,
icon: <a href="#class_ba_Texture">ba.Texture</a> = None,
iconscale: float = None,
icon_tint: float = None,
icon_color: Sequence[float] = None,
autoselect: bool = None,
mask_texture: <a href="#class_ba_Texture">ba.Texture</a> = None,
tint_texture: <a href="#class_ba_Texture">ba.Texture</a> = None,
tint_color: Sequence[float] = None,
tint2_color: Sequence[float] = None,
text_flatness: float = None,
text_res_scale: float = None,
enabled: bool = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a button widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_cameraflash">ba.cameraflash()</a></strong></h3>
<p><span>cameraflash(duration: float = 999.0) -&gt; None</span></p>
<p>Create a strobing camera flash effect.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>(as seen when a team wins a game)
Duration is in seconds.</p>
<hr>
<h2><strong><a name="function_ba_camerashake">ba.camerashake()</a></strong></h3>
<p><span>camerashake(intensity: float = 1.0) -&gt; None</span></p>
<p>Shake the camera.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>Note that some cameras and/or platforms (such as VR) may not display
camera-shake, so do not rely on this always being visible to the
player as a gameplay cue.</p>
<hr>
<h2><strong><a name="function_ba_charstr">ba.charstr()</a></strong></h3>
<p><span>charstr(char_id: <a href="#class_ba_SpecialChar">ba.SpecialChar</a>) -&gt; str</span></p>
<p>Get a unicode string representing a special character.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Note that these utilize the private-use block of unicode characters
(U+E000-U+F8FF) and are specific to the game; exporting or rendering
them elsewhere will be meaningless.</p>
<p>see <a href="#class_ba_SpecialChar">ba.SpecialChar</a> for the list of available characters.</p>
<hr>
<h2><strong><a name="function_ba_checkboxwidget">ba.checkboxwidget()</a></strong></h3>
<p><span>checkboxwidget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None,
parent: <a href="#class_ba_Widget">ba.Widget</a> = None,
size: Sequence[float] = None,
position: Sequence[float] = None,
text: Union[<a href="#class_ba_Lstr">ba.Lstr</a>, str] = None,
value: bool = None,
on_value_change_call: Callable[[bool], None] = None,
on_select_call: Callable[[], None] = None,
text_scale: float = None,
textcolor: Sequence[float] = None,
scale: float = None,
is_radio_button: bool = None,
maxwidth: float = None,
autoselect: bool = None,
color: Sequence[float] = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a check-box widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_columnwidget">ba.columnwidget()</a></strong></h3>
<p><span>columnwidget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None,
parent: <a href="#class_ba_Widget">ba.Widget</a> = None,
size: Sequence[float] = None,
position: Sequence[float] = None,
background: bool = None,
selected_child: <a href="#class_ba_Widget">ba.Widget</a> = None,
visible_child: <a href="#class_ba_Widget">ba.Widget</a> = None,
single_depth: bool = None,
print_list_exit_instructions: bool = None,
left_border: float = None,
top_border: float = None,
bottom_border: float = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a column widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_containerwidget">ba.containerwidget()</a></strong></h3>
<p><span>containerwidget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None,
parent: <a href="#class_ba_Widget">ba.Widget</a> = None,
size: Sequence[float] = None,
position: Sequence[float] = None,
background: bool = None,
selected_child: <a href="#class_ba_Widget">ba.Widget</a> = None,
transition: str = None,
cancel_button: <a href="#class_ba_Widget">ba.Widget</a> = None,
start_button: <a href="#class_ba_Widget">ba.Widget</a> = None,
root_selectable: bool = None,
on_activate_call: Callable[[], None] = None,
claims_left_right: bool = None,
claims_tab: bool = None,
selection_loops: bool = None,
selection_loop_to_parent: bool = None,
scale: float = None,
on_outside_click_call: Callable[[], None] = None,
single_depth: bool = None,
visible_child: <a href="#class_ba_Widget">ba.Widget</a> = None,
stack_offset: Sequence[float] = None,
color: Sequence[float] = None,
on_cancel_call: Callable[[], None] = None,
print_list_exit_instructions: bool = None,
click_activate: bool = None,
always_highlight: bool = None,
selectable: bool = None,
scale_origin_stack_offset: Sequence[float] = None,
toolbar_visibility: str = None,
on_select_call: Callable[[], None] = None,
claim_outside_clicks: bool = None,
claims_up_down: bool = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a container widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_do_once">ba.do_once()</a></strong></h3>
<p><span>do_once() -&gt; bool</span></p>
<p>Register a call at a location and return whether one already happened.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>This is used by 'print_once()' type calls to keep from overflowing
logs. The call functions by registering the filename and line where
The call is made from. Returns True if this location has not been
registered already, and False if it has.</p>
<pre><span><em><small># Example: this print will only fire for the first loop iteration:</small></em></span>
for i in range(10):
if <a href="#function_ba_do_once">ba.do_once</a>():
print('Hello once from loop!')</pre>
<hr>
<h2><strong><a name="function_ba_emitfx">ba.emitfx()</a></strong></h3>
<p><span>emitfx(position: Sequence[float],
velocity: Optional[Sequence[float]] = None,
count: int = 10, scale: float = 1.0, spread: float = 1.0,
chunk_type: str = 'rock', emit_type: str ='chunks',
tendril_type: str = 'smoke') -&gt; None</span></p>
<p>Emit particles, smoke, etc. into the fx sim layer.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>The fx sim layer is a secondary dynamics simulation that runs in
the background and just looks pretty; it does not affect gameplay.
Note that the actual amount emitted may vary depending on graphics
settings, exiting element counts, or other factors.</p>
<hr>
<h2><strong><a name="function_ba_get_collision_info">ba.get_collision_info()</a></strong></h3>
<p><span>get_collision_info(*args: Any) -&gt; Any</span></p>
<p>Return collision related values</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>Returns a single collision value or tuple of values such as location,
depth, nodes involved, etc. Only call this in the handler of a
collision-triggered callback or message</p>
<hr>
<h2><strong><a name="function_ba_get_valid_languages">ba.get_valid_languages()</a></strong></h3>
<p><span>get_valid_languages() -&gt; List[str]</span></p>
<p>Return a list containing names of all available languages.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Languages that may be present but are not displayable on the running
version of the game are ignored.</p>
<hr>
<h2><strong><a name="function_ba_getactivity">ba.getactivity()</a></strong></h3>
<p><span>getactivity(doraise: bool = True) -&gt; <a href="#class_ba_Activity">ba.Activity</a></span></p>
<p>Returns the current <a href="#class_ba_Activity">ba.Activity</a> instance.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>Note that this is based on context; thus code run in a timer generated
in Activity 'foo' will properly return 'foo' here, even if another
Activity has since been created or is transitioning in.
If there is no current Activity an Exception is raised, or if doraise is
False then None is returned instead.</p>
<hr>
<h2><strong><a name="function_ba_getcollidemodel">ba.getcollidemodel()</a></strong></h3>
<p><span>getcollidemodel(name: str) -&gt; <a href="#class_ba_CollideModel">ba.CollideModel</a></span></p>
<p>Return a collide-model, loading it if necessary.</p>
<p>Category: <a href="#function_category_Asset_Functions">Asset Functions</a></p>
<p>Collide-models are used in physics calculations for such things as
terrain.</p>
<p>Note that this function returns immediately even if the media has yet
to be loaded. To avoid hitches, instantiate your media objects in
advance of when you will be using them, allowing time for them to load
in the background if necessary.</p>
<hr>
<h2><strong><a name="function_ba_getmaps">ba.getmaps()</a></strong></h3>
<p><span>getmaps(playtype: str) -&gt; List[str]</span></p>
<p>Return a list of <a href="#class_ba_Map">ba.Map</a> types supporting a playtype str.</p>
<p>Category: <a href="#function_category_Asset_Functions">Asset Functions</a></p>
<p>Maps supporting a given playtype must provide a particular set of
features and lend themselves to a certain style of play.</p>
<p><strong>Play Types:</strong></p>
<p>'melee'
General fighting map.
Has one or more 'spawn' locations.</p>
<p>'team_flag'
For games such as Capture The Flag where each team spawns by a flag.
Has two or more 'spawn' locations, each with a corresponding 'flag'
location (based on index).</p>
<p>'single_flag'
For games such as King of the Hill or Keep Away where multiple teams
are fighting over a single flag.
Has two or more 'spawn' locations and 1 'flag_default' location.</p>
<p>'conquest'
For games such as Conquest where flags are spread throughout the map
- has 2+ 'flag' locations, 2+ 'spawn_by_flag' locations.</p>
<p>'king_of_the_hill' - has 2+ 'spawn' locations, 1+ 'flag_default' locations,
and 1+ 'powerup_spawn' locations</p>
<p>'hockey'
For hockey games.
Has two 'goal' locations, corresponding 'spawn' locations, and one
'flag_default' location (for where puck spawns)</p>
<p>'football'
For football games.
Has two 'goal' locations, corresponding 'spawn' locations, and one
'flag_default' location (for where flag/ball/etc. spawns)</p>
<p>'race'
For racing games where players much touch each region in order.
Has two or more 'race_point' locations.</p>
<hr>
<h2><strong><a name="function_ba_getmodel">ba.getmodel()</a></strong></h3>
<p><span>getmodel(name: str) -&gt; <a href="#class_ba_Model">ba.Model</a></span></p>
<p>Return a model, loading it if necessary.</p>
<p>Category: <a href="#function_category_Asset_Functions">Asset Functions</a></p>
<p>Note that this function returns immediately even if the media has yet
to be loaded. To avoid hitches, instantiate your media objects in
advance of when you will be using them, allowing time for them to load
in the background if necessary.</p>
<hr>
<h2><strong><a name="function_ba_getnodes">ba.getnodes()</a></strong></h3>
<p><span>getnodes() -&gt; list</span></p>
<p>Return all nodes in the current <a href="#class_ba_Context">ba.Context</a>.
Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<hr>
<h2><strong><a name="function_ba_getsession">ba.getsession()</a></strong></h3>
<p><span>getsession(doraise: bool = True) -&gt; <a href="#class_ba_Session">ba.Session</a></span></p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>Returns the current <a href="#class_ba_Session">ba.Session</a> instance.
Note that this is based on context; thus code being run in the UI
context will return the UI context here even if a game Session also
exists, etc. If there is no current Session, an Exception is raised, or
if doraise is False then None is returned instead.</p>
<hr>
<h2><strong><a name="function_ba_getsound">ba.getsound()</a></strong></h3>
<p><span>getsound(name: str) -&gt; <a href="#class_ba_Sound">ba.Sound</a></span></p>
<p>Return a sound, loading it if necessary.</p>
<p>Category: <a href="#function_category_Asset_Functions">Asset Functions</a></p>
<p>Note that this function returns immediately even if the media has yet
to be loaded. To avoid hitches, instantiate your media objects in
advance of when you will be using them, allowing time for them to load
in the background if necessary.</p>
<hr>
<h2><strong><a name="function_ba_gettexture">ba.gettexture()</a></strong></h3>
<p><span>gettexture(name: str) -&gt; <a href="#class_ba_Texture">ba.Texture</a></span></p>
<p>Return a texture, loading it if necessary.</p>
<p>Category: <a href="#function_category_Asset_Functions">Asset Functions</a></p>
<p>Note that this function returns immediately even if the media has yet
to be loaded. To avoid hitches, instantiate your media objects in
advance of when you will be using them, allowing time for them to load
in the background if necessary.</p>
<hr>
<h2><strong><a name="function_ba_hscrollwidget">ba.hscrollwidget()</a></strong></h3>
<p><span>hscrollwidget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None, parent: <a href="#class_ba_Widget">ba.Widget</a> = None,
size: Sequence[float] = None, position: Sequence[float] = None,
background: bool = None, selected_child: <a href="#class_ba_Widget">ba.Widget</a> = None,
capture_arrows: bool = None,
on_select_call: Callable[[], None] = None,
center_small_content: bool = None, color: Sequence[float] = None,
highlight: bool = None, border_opacity: float = None,
simple_culling_h: float = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a horizontal scroll widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_imagewidget">ba.imagewidget()</a></strong></h3>
<p><span>imagewidget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None, parent: <a href="#class_ba_Widget">ba.Widget</a> = None,
size: Sequence[float] = None, position: Sequence[float] = None,
color: Sequence[float] = None, texture: <a href="#class_ba_Texture">ba.Texture</a> = None,
opacity: float = None, model_transparent: <a href="#class_ba_Model">ba.Model</a> = None,
model_opaque: <a href="#class_ba_Model">ba.Model</a> = None, has_alpha_channel: bool = True,
tint_texture: <a href="#class_ba_Texture">ba.Texture</a> = None, tint_color: Sequence[float] = None,
transition_delay: float = None, draw_controller: <a href="#class_ba_Widget">ba.Widget</a> = None,
tint2_color: Sequence[float] = None, tilt_scale: float = None,
mask_texture: <a href="#class_ba_Texture">ba.Texture</a> = None, radial_amount: float = None)
-&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit an image widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_is_browser_likely_available">ba.is_browser_likely_available()</a></strong></h3>
<p><span>is_browser_likely_available() -&gt; bool</span></p>
<p>Return whether a browser likely exists on the current device.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>If this returns False you may want to avoid calling ba.show_url()
with any lengthy addresses. (ba.show_url() will display an address
as a string in a window if unable to bring up a browser, but that
is only useful for simple URLs.)</p>
<hr>
<h2><strong><a name="function_ba_is_point_in_box">ba.is_point_in_box()</a></strong></h3>
<p><span>is_point_in_box(pnt: Sequence[float], box: Sequence[float]) -&gt; bool</span></p>
<p>Return whether a given point is within a given box.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>For use with standard def boxes (position|rotate|scale).</p>
<hr>
<h2><strong><a name="function_ba_log">ba.log()</a></strong></h3>
<p><span>log(message: str, to_console: bool = True, newline: bool = True,
to_server: bool = True) -&gt; None</span></p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Log a message. This goes to the default logging mechanism depending
on the platform (stdout on mac, android log on android, etc).</p>
<p>Log messages also go to the in-game console unless 'to_console'
is False. They are also sent to the master-server for use in analyzing
issues unless to_server is False.</p>
<p>Python's standard print() is wired to call this (with default values)
so in most cases you can just use that.</p>
<hr>
<h2><strong><a name="function_ba_new_activity">ba.new_activity()</a></strong></h3>
<p><span>new_activity(activity_type: Type[<a href="#class_ba_Activity">ba.Activity</a>],
settings: dict = None) -&gt; <a href="#class_ba_Activity">ba.Activity</a></span></p>
<p>Instantiates a <a href="#class_ba_Activity">ba.Activity</a> given a type object.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Activities require special setup and thus cannot be directly
instantiated; You must go through this function.</p>
<hr>
<h2><strong><a name="function_ba_newnode">ba.newnode()</a></strong></h3>
<p><span>newnode(type: str, owner: Union[Node, <a href="#class_ba_Actor">ba.Actor</a>] = None,
attrs: dict = None, name: str = None, delegate: Any = None)
-&gt; Node</span></p>
<p>Add a node of the given type to the game.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>If a dict is provided for 'attributes', the node's initial attributes
will be set based on them.</p>
<p>'name', if provided, will be stored with the node purely for debugging
purposes. If no name is provided, an automatic one will be generated
such as 'terrain@foo.py:30'.</p>
<p>If 'delegate' is provided, Python messages sent to the node will go to
that object's handlemessage() method. Note that the delegate is stored
as a weak-ref, so the node itself will not keep the object alive.</p>
<p>if 'owner' is provided, the node will be automatically killed when that
object dies. 'owner' can be another node or a <a href="#class_ba_Actor">ba.Actor</a></p>
<hr>
<h2><strong><a name="function_ba_normalized_color">ba.normalized_color()</a></strong></h3>
<p><span>normalized_color(color: Sequence[float]) -&gt; Tuple[float, ...]</span></p>
<p>Scale a color so its largest value is 1; useful for coloring lights.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<hr>
<h2><strong><a name="function_ba_open_url">ba.open_url()</a></strong></h3>
<p><span>open_url(address: str) -&gt; None</span></p>
<p>Open a provided URL.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Open the provided url in a web-browser, or display the URL
string in a window if that isn't possible.</p>
<hr>
<h2><strong><a name="function_ba_playsound">ba.playsound()</a></strong></h3>
<p><span>playsound(sound: Sound, volume: float = 1.0,
position: Sequence[float] = None, host_only: bool = False) -&gt; None</span></p>
<p>Play a <a href="#class_ba_Sound">ba.Sound</a> a single time.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>If position is not provided, the sound will be at a constant volume
everywhere. Position should be a float tuple of size 3.</p>
<hr>
<h2><strong><a name="function_ba_print_error">ba.print_error()</a></strong></h3>
<p><span>print_error(err_str: str, once: bool = False) -&gt; None</span></p>
<p>Print info about an error along with pertinent context state.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Prints all positional arguments provided along with various info about the
current context.
Pass the keyword 'once' as True if you want the call to only happen
one time from an exact calling location.</p>
<hr>
<h2><strong><a name="function_ba_print_exception">ba.print_exception()</a></strong></h3>
<p><span>print_exception(*args: Any, **keywds: Any) -&gt; None</span></p>
<p>Print info about an exception along with pertinent context state.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Prints all arguments provided along with various info about the
current context and the outstanding exception.
Pass the keyword 'once' as True if you want the call to only happen
one time from an exact calling location.</p>
<hr>
<h2><strong><a name="function_ba_printnodes">ba.printnodes()</a></strong></h3>
<p><span>printnodes() -&gt; None</span></p>
<p>Print various info about existing nodes; useful for debugging.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<hr>
<h2><strong><a name="function_ba_printobjects">ba.printobjects()</a></strong></h3>
<p><span>printobjects() -&gt; None</span></p>
<p>Print debugging info about game objects.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>This call only functions in debug builds of the game.
It prints various info about the current object count, etc.</p>
<hr>
<h2><strong><a name="function_ba_pushcall">ba.pushcall()</a></strong></h3>
<p><span>pushcall(call: Callable, from_other_thread: bool = False) -&gt; None</span></p>
<p>Pushes a call onto the event loop to be run during the next cycle.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>This can be handy for calls that are disallowed from within other
callbacks, etc.</p>
<p>This call expects to be used in the game thread, and will automatically
save and restore the <a href="#class_ba_Context">ba.Context</a> to behave seamlessly.</p>
<p>If you want to push a call from outside of the game thread,
however, you can pass 'from_other_thread' as True. In this case
the call will always run in the UI context on the game thread.</p>
<hr>
<h2><strong><a name="function_ba_quit">ba.quit()</a></strong></h3>
<p><span>quit(soft: bool = False, back: bool = False) -&gt; None</span></p>
<p>Quit the game.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>On systems like android, 'soft' will end the activity but keep the
app running.</p>
<hr>
<h2><strong><a name="function_ba_rowwidget">ba.rowwidget()</a></strong></h3>
<p><span>rowwidget(edit: Widget =None, parent: Widget =None,
size: Sequence[float] = None,
position: Sequence[float] = None,
background: bool = None, selected_child: Widget = None,
visible_child: Widget = None) -&gt; Widget</span></p>
<p>Create or edit a row widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_safecolor">ba.safecolor()</a></strong></h3>
<p><span>safecolor(color: Sequence[float], target_intensity: float = 0.6)
-&gt; Tuple[float, ...]</span></p>
<p>Given a color tuple, return a color safe to display as text.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Accepts tuples of length 3 or 4. This will slightly brighten very
dark colors, etc.</p>
<hr>
<h2><strong><a name="function_ba_screenmessage">ba.screenmessage()</a></strong></h3>
<p><span>screenmessage(message: Union[str, <a href="#class_ba_Lstr">ba.Lstr</a>],
color: Sequence[float] = None, top: bool = False,
image: Dict[str, Any] = None, log: bool = False,
clients: Sequence[int] = None, transient: bool = False) -&gt; None</span></p>
<p>Print a message to the local client's screen, in a given color.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>If 'top' is True, the message will go to the top message area.
For 'top' messages, 'image' can be a texture to display alongside the
message.
If 'log' is True, the message will also be printed to the output log
'clients' can be a list of client-ids the message should be sent to,
or None to specify that everyone should receive it.
If 'transient' is True, the message will not be included in the
game-stream and thus will not show up when viewing replays.
Currently the 'clients' option only works for transient messages.</p>
<hr>
<h2><strong><a name="function_ba_scrollwidget">ba.scrollwidget()</a></strong></h3>
<p><span>scrollwidget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None, parent: <a href="#class_ba_Widget">ba.Widget</a> = None,
size: Sequence[float] = None, position: Sequence[float] = None,
background: bool = None, selected_child: <a href="#class_ba_Widget">ba.Widget</a> = None,
capture_arrows: bool = False, on_select_call: Callable = None,
center_small_content: bool = None, color: Sequence[float] = None,
highlight: bool = None, border_opacity: float = None,
simple_culling_v: float = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a scroll widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_set_analytics_screen">ba.set_analytics_screen()</a></strong></h3>
<p><span>set_analytics_screen(screen: str) -&gt; None</span></p>
<p>Used for analytics to see where in the app players spend their time.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Generally called when opening a new window or entering some UI.
'screen' should be a string description of an app location
('Main Menu', etc.)</p>
<hr>
<h2><strong><a name="function_ba_setlanguage">ba.setlanguage()</a></strong></h3>
<p><span>setlanguage(language: Optional[str], print_change: bool = True, store_to_config: bool = True) -&gt; None</span></p>
<p>Set the active language used for the game.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Pass None to use OS default language.</p>
<hr>
<h2><strong><a name="function_ba_setmusic">ba.setmusic()</a></strong></h3>
<p><span>setmusic(musictype: Optional[MusicType], continuous: bool = False) -&gt; None</span></p>
<p>Set or stop the current music based on a string musictype.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>This function will handle loading and playing sound media as necessary,
and also supports custom user soundtracks on specific platforms so the
user can override particular game music with their own.</p>
<p>Pass None to stop music.</p>
<p>if 'continuous' is True the musictype passed is the same as what is already
playing, the playing track will not be restarted.</p>
<hr>
<h2><strong><a name="function_ba_sharedobj">ba.sharedobj()</a></strong></h3>
<p><span>sharedobj(name: str) -&gt; Any</span></p>
<p>Return a predefined object for the current Activity, creating if needed.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<p>Available values for 'name':</p>
<p>'globals': returns the 'globals' <a href="#class_ba_Node">ba.Node</a>, containing various global
controls & values.</p>
<p>'object_material': a <a href="#class_ba_Material">ba.Material</a> that should be applied to any small,
normal, physical objects such as bombs, boxes, players, etc. Other
materials often check for the presence of this material as a
prerequisite for performing certain actions (such as disabling collisions
between initially-overlapping objects)</p>
<p>'player_material': a <a href="#class_ba_Material">ba.Material</a> to be applied to player parts. Generally,
materials related to the process of scoring when reaching a goal, etc
will look for the presence of this material on things that hit them.</p>
<p>'pickup_material': a <a href="#class_ba_Material">ba.Material</a>; collision shapes used for picking things
up will have this material applied. To prevent an object from being
picked up, you can add a material that disables collisions against things
containing this material.</p>
<p>'footing_material': anything that can be 'walked on' should have this
<a href="#class_ba_Material">ba.Material</a> applied; generally just terrain and whatnot. A character will
snap upright whenever touching something with this material so it should
not be applied to props, etc.</p>
<p>'attack_material': a <a href="#class_ba_Material">ba.Material</a> applied to explosion shapes, punch
shapes, etc. An object not wanting to receive impulse/etc messages can
disable collisions against this material.</p>
<p>'death_material': a <a href="#class_ba_Material">ba.Material</a> that sends a <a href="#class_ba_DieMessage">ba.DieMessage</a>() to anything
that touches it; handy for terrain below a cliff, etc.</p>
<p>'region_material': a <a href="#class_ba_Material">ba.Material</a> used for non-physical collision shapes
(regions); collisions can generally be allowed with this material even
when initially overlapping since it is not physical.</p>
<p>'railing_material': a <a href="#class_ba_Material">ba.Material</a> with a very low friction/stiffness/etc
that can be applied to invisible 'railings' useful for gently keeping
characters from falling off of cliffs.</p>
<hr>
<h2><strong><a name="function_ba_show_damage_count">ba.show_damage_count()</a></strong></h3>
<p><span>show_damage_count(damage: str, position: Sequence[float], direction: Sequence[float]) -&gt; None</span></p>
<p>Pop up a damage count at a position in space.</p>
<p>Category: <a href="#function_category_Gameplay_Functions">Gameplay Functions</a></p>
<hr>
<h2><strong><a name="function_ba_textwidget">ba.textwidget()</a></strong></h3>
<p><span>textwidget(edit: Widget = None, parent: Widget = None,
size: Sequence[float] = None, position: Sequence[float] = None,
text: Union[str, <a href="#class_ba_Lstr">ba.Lstr</a>] = None, v_align: str = None,
h_align: str = None, editable: bool = None, padding: float = None,
on_return_press_call: Callable[[], None] = None,
on_activate_call: Callable[[], None] = None,
selectable: bool = None, query: Widget = None, max_chars: int = None,
color: Sequence[float] = None, click_activate: bool = None,
on_select_call: Callable[[], None] = None,
always_highlight: bool = None, draw_controller: Widget = None,
scale: float = None, corner_scale: float = None,
description: Union[str, <a href="#class_ba_Lstr">ba.Lstr</a>] = None,
transition_delay: float = None, maxwidth: float = None,
max_height: float = None, flatness: float = None,
shadow: float = None, autoselect: bool = None, rotate: float = None,
enabled: bool = None, force_internal_editing: bool = None,
always_show_carat: bool = None, big: bool = None,
extra_touch_border_scale: float = None, res_scale: float = None)
-&gt; Widget</span></p>
<p>Create or edit a text widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Pass a valid existing <a href="#class_ba_Widget">ba.Widget</a> as 'edit' to modify it; otherwise
a new one is created and returned. Arguments that are not set to None
are applied to the Widget.</p>
<hr>
<h2><strong><a name="function_ba_time">ba.time()</a></strong></h3>
<p><span>time(timetype: <a href="#class_ba_TimeType">ba.TimeType</a> = TimeType.SIM,
timeformat: <a href="#class_ba_TimeFormat">ba.TimeFormat</a> = TimeFormat.SECONDS)
-&gt; Union[float, int]</span></p>
<p>Return the current time.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>The time returned depends on the current <a href="#class_ba_Context">ba.Context</a> and timetype.</p>
<p>timetype can be either SIM, BASE, or REAL. It defaults to
SIM. Types are explained below:</p>
<p>SIM time maps to local simulation time in <a href="#class_ba_Activity">ba.Activity</a> or <a href="#class_ba_Session">ba.Session</a>
Contexts. This means that it may progress slower in slow-motion play
modes, stop when the game is paused, etc. This time type is not
available in UI contexts.</p>
<p>BASE time is also linked to gameplay in <a href="#class_ba_Activity">ba.Activity</a> or <a href="#class_ba_Session">ba.Session</a>
Contexts, but it progresses at a constant rate regardless of
slow-motion states or pausing. It can, however, slow down or stop
in certain cases such as network outages or game slowdowns due to
cpu load. Like 'sim' time, this is unavailable in UI contexts.</p>
<p>REAL time always maps to actual clock time with a bit of filtering
added, regardless of Context. (the filtering prevents it from going
backwards or jumping forward by large amounts due to the app being
backgrounded, system time changing, etc.)</p>
<p>the 'timeformat' arg defaults to SECONDS which returns float seconds,
but it can also be MILLISECONDS to return integer milliseconds.</p>
<p>Note: If you need pure unfiltered clock time, just use the standard
Python functions such as time.time().</p>
<hr>
<h2><strong><a name="function_ba_timer">ba.timer()</a></strong></h3>
<p><span>timer(time: float, call: Callable[[], Any], repeat: bool = False,
timetype: <a href="#class_ba_TimeType">ba.TimeType</a> = TimeType.SIM,
timeformat: <a href="#class_ba_TimeFormat">ba.TimeFormat</a> = TimeFormat.SECONDS,
suppress_format_warning: bool = False)
-&gt; None</span></p>
<p>Schedule a call to run at a later point in time.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>This function adds a timer to the current <a href="#class_ba_Context">ba.Context</a>.
This timer cannot be canceled or modified once created. If you
require the ability to do so, use the <a href="#class_ba_Timer">ba.Timer</a> class instead.</p>
<p>time: length of time (in seconds by default) that the timer will wait
before firing. Note that the actual delay experienced may vary
depending on the timetype. (see below)</p>
<p>call: A callable Python object. Note that the timer will retain a
strong reference to the callable for as long as it exists, so you
may want to look into concepts such as <a href="#class_ba_WeakCall">ba.WeakCall</a> if that is not
desired.</p>
<p>repeat: if True, the timer will fire repeatedly, with each successive
firing having the same delay as the first.</p>
<p>timetype can be either 'sim', 'base', or 'real'. It defaults to
'sim'. Types are explained below:</p>
<p>'sim' time maps to local simulation time in <a href="#class_ba_Activity">ba.Activity</a> or <a href="#class_ba_Session">ba.Session</a>
Contexts. This means that it may progress slower in slow-motion play
modes, stop when the game is paused, etc. This time type is not
available in UI contexts.</p>
<p>'base' time is also linked to gameplay in <a href="#class_ba_Activity">ba.Activity</a> or <a href="#class_ba_Session">ba.Session</a>
Contexts, but it progresses at a constant rate regardless of
slow-motion states or pausing. It can, however, slow down or stop
in certain cases such as network outages or game slowdowns due to
cpu load. Like 'sim' time, this is unavailable in UI contexts.</p>
<p>'real' time always maps to actual clock time with a bit of filtering
added, regardless of Context. (the filtering prevents it from going
backwards or jumping forward by large amounts due to the app being
backgrounded, system time changing, etc.)
Real time timers are currently only available in the UI context.</p>
<p>the 'timeformat' arg defaults to seconds but can also be milliseconds.</p>
<pre><span><em><small># timer example: print some stuff through time:</small></em></span>
<a href="#function_ba_screenmessage">ba.screenmessage</a>('hello from now!')
<a href="#function_ba_timer">ba.timer</a>(1.0, <a href="#class_ba_Call">ba.Call</a>(<a href="#function_ba_screenmessage">ba.screenmessage</a>, 'hello from the future!'))
<a href="#function_ba_timer">ba.timer</a>(2.0, <a href="#class_ba_Call">ba.Call</a>(<a href="#function_ba_screenmessage">ba.screenmessage</a>, 'hello from the future 2!'))</pre>
<hr>
<h2><strong><a name="function_ba_timestring">ba.timestring()</a></strong></h3>
<p><span>timestring(timeval: float, centi: bool = True, timeformat: <a href="#class_ba_TimeFormat">ba.TimeFormat</a> = &lt;TimeFormat.SECONDS: 0&gt;, suppress_format_warning: bool = False) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Generate a <a href="#class_ba_Lstr">ba.Lstr</a> for displaying a time value.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Given a time value, returns a <a href="#class_ba_Lstr">ba.Lstr</a> with:
(hours if &gt; 0 ) : minutes : seconds : (centiseconds if centi=True).</p>
<p>Time 'timeval' is specified in seconds by default, or 'timeformat' can
be set to <a href="#class_ba_TimeFormat">ba.TimeFormat</a>.MILLISECONDS to accept milliseconds instead.</p>
<p>WARNING: the underlying Lstr value is somewhat large so don't use this
to rapidly update Node text values for an onscreen timer or you may
consume significant network bandwidth. For that purpose you should
use a 'timedisplay' Node and attribute connections.</p>
<hr>
<h2><strong><a name="function_ba_uicleanupcheck">ba.uicleanupcheck()</a></strong></h3>
<p><span>uicleanupcheck(obj: Any, widget: <a href="#class_ba_Widget">ba.Widget</a>) -&gt; None</span></p>
<p>Add a check to ensure a widget-owning object gets cleaned up properly.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>This adds a check which will print an error message if the provided
object still exists ~5 seconds after the provided <a href="#class_ba_Widget">ba.Widget</a> dies.</p>
<p>This is a good sanity check for any sort of object that wraps or
controls a <a href="#class_ba_Widget">ba.Widget</a>. For instance, a 'Window' class instance has
no reason to still exist once its root container <a href="#class_ba_Widget">ba.Widget</a> has fully
transitioned out and been destroyed. Circular references or careless
strong referencing can lead to such objects never getting destroyed,
however, and this helps detect such cases to avoid memory leaks.</p>
<hr>
<h2><strong><a name="function_ba_vec3validate">ba.vec3validate()</a></strong></h3>
<p><span>vec3validate(value: Sequence[float]) -&gt; Sequence[float]</span></p>
<p>Ensure a value is valid for use as a Vec3.</p>
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
<p>Raises a TypeError exception if not.
Valid values include any type of sequence consisting of 3 numeric values.
Returns the same value as passed in (but with a definite type
so this can be used to disambiguate 'Any' types).
Generally this should be used in 'if __debug__' or assert clauses
to keep runtime overhead minimal.</p>
<hr>
<h2><strong><a name="function_ba_widget">ba.widget()</a></strong></h3>
<p><span>widget(edit: <a href="#class_ba_Widget">ba.Widget</a> = None, up_widget: <a href="#class_ba_Widget">ba.Widget</a> = None,
down_widget: <a href="#class_ba_Widget">ba.Widget</a> = None, left_widget: <a href="#class_ba_Widget">ba.Widget</a> = None,
right_widget: <a href="#class_ba_Widget">ba.Widget</a> = None, show_buffer_top: float = None,
show_buffer_bottom: float = None, show_buffer_left: float = None,
show_buffer_right: float = None, autoselect: bool = None) -&gt; None</span></p>
<p>Edit common attributes of any widget.</p>
<p>Category: <a href="#function_category_User_Interface_Functions">User Interface Functions</a></p>
<p>Unlike other UI calls, this can only be used to edit, not to create.</p>