DudeAwesome Posted January 14, 2014 Share Posted January 14, 2014 When I create models in Code it will be something like: cube = new Cube(3) it will create for e.g. a cube with n=3 and I can use cube.setSomething() to use a private function of the Object Cube() but how I can access models (like a door) that Ive created in the editor? its a little bit confusing. when I create something in the editor, I have no code from it. When I create a cube with some lines of code. I see it in the GameRun but not in the Editor. Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 14, 2014 Share Posted January 14, 2014 You can iterate through all the entities of the map. You could find its name or tag. Note that objects can be named the same, so might get different results. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/world/ 1 Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted January 14, 2014 Author Share Posted January 14, 2014 thx Aggror! Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
YouGroove Posted January 14, 2014 Share Posted January 14, 2014 In Lua there is some neighboor function that do the same. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted January 14, 2014 Share Posted January 14, 2014 but how I can access models (like a door) that Ive created in the editor? This depends on how you want to code things. Do you like doing everything in an int main() type function or are you ok with not seeing an int main()? You can attach a script to an object in the editor and now imagine that's the class for that object. Inside you have a constructor (Start()) and an Update (UpdateWorld()). If it needs access to other objects you can have it take parameters and you can drag and drop the objects from the editor to fill in those parameters (you can even do that in code). If you are an int main() guy, the entity script style can be a little different, but if you approach it with the mindset of the script is a class that runs for that entity you attached it too, then it's not so different. It removes the plumbing code that we would have to do normally. If you create something in code, normally in this script style you'd be creating prefabs, you can fill in it's script parameters in code too. This is what I did with a spawner script. I will be making a tutorial on how to do a spawner script this week and you can see. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.