foundry.smb3parse.objects package#

Submodules#

foundry.smb3parse.objects.enemy_item module#

class EnemyItem(data)#

Bases: InLevelObject

foundry.smb3parse.objects.level_object module#

class LevelObject(data: bytearray)#

Bases: InLevelObject

foundry.smb3parse.objects.tileset module#

exception TilesetError(tileset_index: int)#

Bases: ValueError

ensure_tileset(tileset_index: int) None#
is_tileset_index(tileset_index: int)#

Module contents#

Describes all objects, that are part of a level, i. e. platforms, enemies, items, jumps, auto scroll objects etc.

class InLevelObject(data: bytearray)#

Bases: ABC

Describes objects that are positioned at a specific place in a level and have some sort of representation, be it visible like platforms and enemies or invisible, like auto scroll items or jumps.

property additional_length#
property domain#
property has_additional_length#
property id#
property x#
property y#
class LevelComponent(domain: int = 0, index: int = 0, point: Point = NOTHING)#

Bases: object

A basic implementation of ~foundry.smb3parse.objects.LevelComponentProtocol.

Attributes:
domain: int

The domain or set of component that the component is housed inside. Must be between 0 and 7.

index: int

The specific byte of data that determines a limited amount of information with regard to the component. Must be between 0 and 255.

point: int

The location inside the level that the component is housed. Both x and y must be between 0 and 255.

domain: int#
index: int#
point: Point#
class LevelComponentProtocol(*args, **kwargs)#

Bases: Protocol

An outline of any object that composes an element inside the game.

Attributes:
domain: int

The domain or set of component that the component is housed inside.

index: int

The specific byte of data that determines a limited amount of information with regard to the component.

point: int

The location inside the level that the component is housed.

domain: int#
index: int#
point: Point#
domain_check(instance, attribute, value)#

A check to ensure that the domain of a given object is between 0 and 7.

Raises:
TypeError

Will be raised if the domain is not an integer.

ValueError

Will be raised if the domain is not between 0 and 7.

index_check(instance, attribute, value)#

A check to ensure that the index of a given object is between 0 and 255.

Raises:
TypeError

Will be raised if the index is not an integer.

ValueError

Will be raised if the index is not between 0 and 255.

position_check(instance, attribute, value)#

A check to ensure that the point of a given object has an x and y that are between 0 and 255.

Raises:
ValueError

Will be raised if either the x or y is not between 0 and 255.

AttributeError

Will be raised if the point does not contain a field for x or y.