Skip to content

StaticActor

An immovable body that other objects can collide with.

Description

StaticActor is optimized to skip the spatial grid and act as a fixed boundary. It is ideal for floors, walls, and level geometry.

Namespace

namespace pixelroot32::physics {
    class StaticActor {
        // ...
    };
}

Inheritance

Constructors

  • StaticActor(Scalar x, Scalar y, int w, int h) Constructs a new StaticActor.

  • StaticActor(Vector2 position, int w, int h) Constructs a new StaticActor using a position vector.

Public Methods

  • void draw(pixelroot32::graphics::Renderer& renderer) Draws the actor.

Example

auto floor = std::make_unique<StaticActor>(0, 230, 240, 10);
floor->setCollisionLayer(Layers::kWall);
scene->addEntity(floor.get());