Glop Actor Heirarchy

Just as POE has Components, Glop has Actors. And unlike the rest of the design, you use Actors by inheriting from them (well, you can use them directly, too). A simple Actor that will come with glop will be the 2D::Circle actor, which is good enough to toss into a scene and watch it bounce around. Of course, there will need to be things for it to bounce against. That’s what 2D::Wall is for. It is not, by default, affected by gravity, but it registers collisions.

I envisage a program in which a ball bounces around the screen, in its entirety, as such:

    use Glop qw{-fullscreen -2d},
            -view => [ 0, 0, 32, 24 ];   # set the viewport to (0,0)-(32,24)
    $KERNEL->world->gravity(v(0, -9.8));
    $KERNEL->add(Glop::Actor::2D::Wall->new(v(0,0), v(32, 1));   # floor
    $KERNEL->add(Glop::Actor::2D::Wall->new(v(0,0), v(1, 24));   # left
    $KERNEL->add(Glop::Actor::2D::Wall->new(v(31,0), v(32,24));  # right

Note, here, that the program responds to an OS quit event, and quits if you push escape. It just runs otherwise. Also note that the keyboard handling is already implemented, as well as the $KERNEL->add and $KERNEL->run methods. The next thing I’ll be working on is integrating ODE, followed by the collision detector. After that’s done, I’ll probaby have less than two weeks to prepare my presentation, so, um, yeah, I’ll be doing that.


1 thought on “Glop Actor Heirarchy

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s