Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Adventure Bird on August 25, 2009, 11:20:50 PM

Title: Existing entity on layer
Post by: Adventure Bird on August 25, 2009, 11:20:50 PM
I want to display some prepared entities on the top layer of the scene. In the sdk I found just a method to create new entity on a layer. (add/insert)

Is it possible to load an entity like that: Scene.LoadEntity(). // Into which layer will entity be loaded, always main layer?

Title: Re: Existing entity on layer
Post by: metamorphium on August 26, 2009, 07:42:13 AM
well, AFAIK you have two options.

1, use Layer.InsertEntity (or Layer.AddEntity) which creates an empty entity in the Layer which can be customized in the runtime.
2, set those entities in the Scene editor and change their Active state

Unless there is some undocumented feature, for layer operations you can't load an entity file.

example:
Code: WME Script
  1. var layer = Scene.GetLayer("layer name");
  2. var ent = layer.AddEntity("myTest");
  3. ent.SetSpite([path to file]);
  4. ent.X = 123;
  5. ent.Y = 232;
  6. ent.Active = true;
  7.  
Title: Re: Existing entity on layer
Post by: Mnemonic on August 26, 2009, 08:32:55 AM
So-called "free entities" (i.e. those that live in external files or are created with CreateEntity() ) can only exist in the main layer. So, meta is right.
Title: Re: Existing entity on layer
Post by: Adventure Bird on August 26, 2009, 07:56:55 PM
Thank I use the way be add dynamic entities now.