Arcade Game Development Library
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advanced features including particle systems, A* pathfinding, performance monitoring, tilemap support, and experimental rendering effects for enhanced game functionality.
class Emitter:
"""
Particle emitter for creating visual effects.
"""
def __init__(self, center_xy: tuple[float, float],
emit_controller: arcade.EmitController,
particle_factory: callable):
"""Create particle emitter."""
center_xy: tuple[float, float]
def update(self) -> None:
"""Update particles and emission."""
def draw(self) -> None:
"""Draw all particles."""
class Particle:
"""Base particle class."""
def __init__(self):
"""Create particle."""
position: tuple[float, float]
velocity: tuple[float, float]
lifetime: float
def update(self) -> bool:
"""Update particle. Returns True if still alive."""
class EmitController:
"""Controls when and how particles are emitted."""
def can_emit(self) -> bool:
"""Check if emission should occur."""
def make_burst_emitter(center_xy: tuple[float, float], particle_factory: callable,
particle_count: int) -> arcade.Emitter:
"""Create burst emitter."""
def make_interval_emitter(center_xy: tuple[float, float], particle_factory: callable,
interval: float, particle_count: int) -> arcade.Emitter:
"""Create interval-based emitter."""class AStarBarrierList:
"""
Barrier list for A* pathfinding algorithm.
"""
def __init__(self, moving_sprite: arcade.Sprite, blocking_sprites: arcade.SpriteList,
grid_size: int, left: int, right: int, bottom: int, top: int):
"""Create A* barrier list."""
def astar_calculate_path(start_point: tuple[int, int], end_point: tuple[int, int],
barriers: arcade.AStarBarrierList,
diagonal_movement: bool = True) -> list[tuple[int, int]]:
"""
Calculate path using A* algorithm.
Args:
start_point: Starting grid position
end_point: Target grid position
barriers: Barrier list with obstacles
diagonal_movement: Allow diagonal movement
Returns:
List of grid positions forming the path
"""
def has_line_of_sight(point1: tuple[float, float], point2: tuple[float, float],
barriers: arcade.AStarBarrierList) -> bool:
"""
Check line of sight between two points.
Args:
point1: First point
point2: Second point
barriers: Obstacles to check against
Returns:
True if clear line of sight exists
"""class PerfGraph:
"""
Visual performance graph for monitoring frame rates and timing.
"""
def __init__(self, width: int, height: int, graph_data: str,
sample_count: int = 60):
"""Create performance graph."""
def update(self, value: float) -> None:
"""Add new performance sample."""
def draw(self) -> None:
"""Draw performance graph."""
def enable_timings() -> None:
"""Enable performance timing collection."""
def disable_timings() -> None:
"""Disable performance timing collection."""
def get_fps() -> float:
"""Get current frames per second."""
def print_timings() -> None:
"""Print collected timing information."""
def get_timings() -> dict:
"""Get timing data programmatically."""
def clear_timings() -> None:
"""Clear collected timing data."""class TileMap:
"""
Manages tile-based maps for 2D games.
"""
def __init__(self):
"""Create tilemap."""
# Map properties
width: int
height: int
tile_width: int
tile_height: int
# Sprite lists for different layers
sprite_lists: dict[str, arcade.SpriteList]
def get_cartesian(self, x: int, y: int) -> tuple[float, float]:
"""Convert tile coordinates to world coordinates."""
def get_tilemap_layer(self, layer_name: str) -> arcade.SpriteList:
"""Get sprite list for specific layer."""
def load_tilemap(map_path: str, scaling: float = 1.0,
layer_options: dict = None) -> arcade.TileMap:
"""
Load tilemap from TMX file.
Args:
map_path: Path to TMX tilemap file
scaling: Scale factor for tiles
layer_options: Options for specific layers
Returns:
Loaded TileMap object
"""class Scene:
"""
Container for managing multiple sprite lists as named layers.
"""
def __init__(self, sprite_lists: dict[str, arcade.SpriteList] = None):
"""Create scene with optional initial sprite lists."""
def add_sprite_list(self, name: str, sprite_list: arcade.SpriteList = None) -> None:
"""Add sprite list layer to scene."""
def get_sprite_list(self, name: str) -> arcade.SpriteList:
"""Get sprite list by layer name."""
def remove_sprite_list(self, name: str) -> None:
"""Remove sprite list layer."""
def update(self, names: list[str] = None) -> None:
"""Update specified layers or all layers."""
def draw(self, names: list[str] = None, **kwargs) -> None:
"""Draw specified layers or all layers."""
class SceneKeyError(Exception):
"""Exception for scene layer access errors."""
pass# Shader effects
class Shadertoy:
"""
Shadertoy-compatible shader system for visual effects.
"""
def __init__(self, size: tuple[int, int], main_source: str):
"""Create Shadertoy shader."""
def render(self, time: float = 0, mouse_position: tuple[float, float] = (0, 0)) -> None:
"""Render shader effect."""
class CRTFilter:
"""CRT monitor visual effect filter."""
def __init__(self, width: int, height: int):
"""Create CRT filter."""
def use(self) -> None:
"""Apply CRT effect to subsequent rendering."""
def render(self) -> None:
"""Render CRT effect."""
class BloomFilter:
"""Bloom lighting effect filter."""
def __init__(self, width: int, height: int, threshold: float = 0.7):
"""Create bloom filter."""
threshold: float
def use(self) -> None:
"""Apply bloom effect."""
def render(self) -> None:
"""Render bloom effect."""class HitBox:
"""Base hit box class for collision detection."""
def __init__(self, points: list[tuple[float, float]]):
"""Create hit box from points."""
points: list[tuple[float, float]]
def create_rotated(self, angle: float) -> 'HitBox':
"""Create rotated version of hit box."""
class RotatableHitBox(HitBox):
"""Hit box that supports rotation."""
def __init__(self, points: list[tuple[float, float]]):
"""Create rotatable hit box."""
def rotate(self, angle: float) -> None:
"""Rotate hit box by angle."""
# Hit box algorithms
class SimpleHitBoxAlgorithm:
"""Simple rectangular hit box algorithm."""
def calculate(self, texture: arcade.Texture) -> list[tuple[float, float]]:
"""Calculate simple hit box points."""
class PymunkHitBoxAlgorithm:
"""Detailed hit box using Pymunk for complex shapes."""
def calculate(self, texture: arcade.Texture, detail: float = 4.5) -> list[tuple[float, float]]:
"""Calculate detailed hit box points."""
# Algorithm instances
algo_simple: SimpleHitBoxAlgorithm
algo_detailed: PymunkHitBoxAlgorithm
algo_default: SimpleHitBoxAlgorithm # Default algorithmimport arcade
class ParticleDemo(arcade.Window):
def __init__(self):
super().__init__(800, 600, "Particle Effects")
self.emitter_list = []
def setup(self):
# Create explosion effect
def make_particle():
particle = arcade.FadeParticle(
filename_or_texture=":resources:images/space_shooter/meteorGrey_med1.png",
change_xy=(arcade.rand_vec_magnitude(0, 2, 5)),
scale=0.1,
lifetime=2.0
)
return particle
# Burst emitter for explosion
explosion = arcade.make_burst_emitter(
center_xy=(400, 300),
particle_factory=make_particle,
particle_count=50
)
self.emitter_list.append(explosion)
def on_draw(self):
self.clear()
for emitter in self.emitter_list:
emitter.draw()
def on_update(self, delta_time):
for emitter in self.emitter_list:
emitter.update()
def main():
game = ParticleDemo()
game.setup()
arcade.run()
if __name__ == "__main__":
main()Install with Tessl CLI
npx tessl i tessl/pypi-arcade