Jump to content

Recommended Posts

Posted

Hi,

 

I am trying to work out the best way for me to find an entity in the world after using Map::Load.

 

I have an entity I have positioned in the Leadwerks editor with the name "SkyBox", after calling Map::Load what is the best way to retrieve this entity (in C++)

 

Regards,

James

Posted

Thanks for the replys guys!

 

I went with:

 

Entity *EntityByName (std::string name)
{

for ( int t = 0; t < world->CountEntities(); ++t )
{
Entity* e = world->GetEntity(t);
if(e->GetKeyValue("name") == name)
{
return e;
}
}

return 0;

}

  • Upvote 1
Posted

Interesting code.

I didn't know we could go that way with countEntities().

It seems lot more natural linear programming than using callbacks, i'll give it a try.

Stop toying and make games

  • 6 months later...
Posted

This was just added today by an old member so it was in my head :)

 

We are trying to get that wiki established as a place we can all go and contribute whatever we can.

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.

×
×
  • Create New...