data

base

class fireform.data.base

Base class from which other data objects should inherit

Attributes:
name: string

Specifies the name of the component. Should be overridden in the child class. This is used when accessing the component as my_entity['name']. Leave unset to make this method of access not available.

attribute_name: string

This is used when accessing the component as my_entity.attribute_name. Leave unset to make this method of access not available. It is advisiable not to set this except for components that are accessed very frequently.

box

class fireform.data.box(x=0, y=0, pos=None, width=10, height=10, size=None, anchor_x=0.5, anchor_y=0.5, anchor=None)

Represents the bounding box of an entity.

Attributes:
x : float

The x ordinate of the box’s origin.

y : float

The y ordinate of the box’s origin.

width : float

The width of the box.

height : float

The height of the box.

anchor_x : float

The position of the box’s x origin relative to the sides of the box. 0 is on the left, 1 is on the right and 0.5 is in the middle. Defaults to 0.5.

anchor_y : float

The position of the box’s y origin relative to the sides of the box. 0 is on the bottom, 1 is on the top and 0.5 is in the middle. Defaults to 0.5.

area

The box’s area.

bottom

The y co-ordinate of the bottom of the box.

Setting this property will change the box’s position and keep its height the same.

contains(point)

Returns true iff the point lies inside the box.

Parameters:
point : fireform.geom.vector

The point to test.

left

The x co-ordinate of the left hand side of the box.

Setting this property will change the box’s position and keep its width the same.

rectangle

A fireform.geom.rectangle in the same space as the box.

right

The x co-ordinate of the right hand side of the box.

Setting this property will change the box’s position and keep its width the same.

top

The y co-ordinate of the top of the box.

Setting this property will change the box’s position and keep its height the same.

image

class fireform.data.image(image=None, depth=0, frame=0, speed=0, scale=1, rotation=0, blend=None, alpha=255, scissor=None)

Used to show an image!

Attirbutes:
image : string

The name of the image to display.

frame : float

The frame of the animation to display. This will be rounded down when actually determining which frame to show.

roation : float

Rotation of the image. Clockwise, in degrees.

scale : fireform.geom.vector

How the image should be stretched.

speed : float

The number of frames to advance per tick.

alpha : int

The opacity of the image, in the range of 0 to 255 inclusive. 255 is completely solid, 0 is invisible.

blend : string

Experimental.

scissor : fireform.entity.entity

Experimental.

velocity

class fireform.data.velocity(*args, x=None, y=None)

The speed of an entity.

acceleration

class fireform.data.acceleration(*args, x=None, y=None)

Acceleration datum.

Acceleration is defined as change in velocity per tick. This will have no impact on the instance unless it also has the velocity and position datum objects.

Attributes:
x: int

Acceleration on the x-axis in pixels per tick per tick.

y: int

Acceleration on the y-axis in pixels per tick per tick.

friction

class fireform.data.friction(*args)

Multiplies the velocity of an entity every tick, causing it to accelerate or decelerate.

collision_bucket

class fireform.data.collision_bucket(bucket='default', extrovert=False)

Specifies the bucket of collisions into which this entity should be entered. Entities need to be in the same bucket in order to recieve collision events.

Parameters:
bucket: string

The name of the bucket. Technically this can actually be any type that can be hashed in order to be put into a dictionary

extrovert: bool

Whether the entity is ‘extroverted’. Two entities that are both extroverted cannot collide with each other. Defaults to False.

camera

class fireform.data.camera(zoom=1, weight=1)

Camera data. You can attach this to entities and the camera will follow them around.

If you have multiple entities with a camera, the view will be positioned at their average location, however the view will NOT zoom if they get too far aprt.