Skip to content
aubergine10 edited this page Oct 20, 2015 · 3 revisions

##Overview

The MobileObject setting enables an Object to be pushed around by an Entity.

##Syntax

The setting is used in materials.txt and must be within a BEGIN Object ... definition block. It can be used only once per definition block.

    Properties MobileObject

##Notes

In order to push the object, an entity must be navigated to it and then use code such as the following:

local function pushObject( object, entity )
  -- set mobile object as being carried by entity:
  object.Carried.i , object.Carried.u  = entity.Id.i, entity.Id.u
  -- set entity as carrying the mobile object:
  entity.Carrying.i, entity.Carrying.u = object.Id.i, object.Id.u
end

The MobileObject property ensures that the object stays on the ground rather than being picked up by the entity.

To stop pushing the object, just set the .i and .u on the left to -1.

In your Update() event handler you'll probably want to set the mobile objects' .Or to match that of the entity pushing it every few updates, this will ensure it faces the right way if direction changes.

###data/scripts/

##See Also

Clone this wiki locally