Jump to content
Pixel Perfect

Assignment of EntityTypes in the Editor properties dialog

Recommended Posts

I wish to implement my own set of Entity Types when assigning EntityTypes in the editor; as the currently provided ones in the properties system don't meet my requirements.


Am I correct in the following assumptions:


  • The properties combo box simply returns an integer representing the entry position of the chosen type which is output as the collision type in the sbx file.


  • The collisions defined in the collisions.lua file are then implemented based on the constants defined in the collision_const.lua file


So all I would need to do is redefine the set of Entity Types for the combo box in base1.lua and add my own constants and collision definitions?


I assume the Engine implements this in the same way as the Editor.

Share this post

Link to post

base1.lua is from the old multi-state lua arrangement we had initially for a couple of months when LE2.3 first came out. You would want to edit the class.lua script to give all of your entities access to your newly defined collisiontype in the latest version of LE.


So edit this line in class.lua to include your new collisiontype (add after 'Trigger'):

 group:AddProperty( "collisiontype", PROPERTY_CHOICE, "None,Prop,Scene,Character,Trigger,AI,Pixel", "Collision" )

Note: I had to add the 'AI' as well since it was missing in the class.lua file but defined in the following other files...


then define the collisiontype in the collision_const.lua file located in the Scripts/constants folder:



and then edit the collisions.lua file located in the Scipts/start folder as needed to define how your collisiontype reacts in the world:




granted you could add all of this just as hardcode into the specific script for your entity, but this above will give you the ability to add that same collisiontype automatically to any other scripted object you create...

Share this post

Link to post

Thanks Mack, so it's class.lua. MG had suggested class.lua too. I was going to replace the entire set actually, rather than append to it, unless you know of any reason why I shouldn't. I'm assuming there are no hard coded references to these.


It's just my engine already defines a set of Entity Type names and associated values and I'd like to continue with that and have it reflected at level design time within the Editor.


So how many of the Lua script files are redundant legacy stuff? Guess I need to sit down and go through all the script structure at some point.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...