Jump to content

Create entities dynamically


mixpro
 Share

Recommended Posts

Hi im new to leadwerks sorry if this might sound so easy .

 

i have leadwerks 3.5 c++,lua , i opened a new project and tried to create an entity using lua code ,

i mean i have two .cpp files (main,app) and then i have a main.lua file , i tried writing the code in this http://www.leadwerks.com/werkspace/page/api-reference/_/emitter/emittercreate-r618 link in the main.lua file before the line :

while window:KeyDown(Key.Escape)==false do

but it didn't work .

i tried adding an emitter in the editor and was successful , i want to know how can you add entities using code and see them when you press run game in the editor .

Link to comment
Share on other sites

Leadwerks recently changed the way the application starts. The entry point of the game was App.lua. Now it's Main.lua. API doc does not yet reflect that change and continues to give examples using App.lua.

 

That said, you can simply create an App.lua (named exactly that way) script in Scripts folder (should be exactly in that folder) and copy paste examples from API doc pages. They should work instantly. Namely, if LE finds App.lua, it treats it as an entry point for your game, for the backwards combatibility sake.

 

Anyway, create App.lua file, copy paste example in it and you should be fine for now. You can tweak the examples in order to understand better how LE works.

 

Hope that helps...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

 Share

×
×
  • Create New...