Skip to content
floere edited this page Sep 14, 2010 · 2 revisions

Use this if you need a thing that can have other things attached.

Including Pod

The Shot trait can be applied as usual:

class Tank < Thing
  it_is_a Pod

or

class Tank < Thing
  it_is_a Pod do
    # …
  end

Properties

Pod just has one property attach, which defines what is attached.

class Tank < Thing
  # …
  attach MainGun, 5, 5

Methods

Pod installs basically two methods, attach and detach.

The first of these, attach <thing>, x, y can be used to dynamically attach something. The is an instance of a thing.

class BattleCruiser < Thing
  # …
  def damaged!
    attach BlastHole, (rand-0.5)*20, (rand-0.5)*20
  end

The second, detach <thing> can be used to again remove the thing from the other thing. It will then freely move, obeying gravity and what not.