Jump to content

Using Map Load Hook To Remove Entities


gamecreator
 Share

Recommended Posts

I was thinking of using the map load hook to remove rocks in a map and replace them with my own since they need to be interacted with (broken apart). Something like the following:

 


void MapLoadCallback(Entity* entity, Object* extra)

{

std::string text = entity->GetKeyValue("name");

 

if(text.compare("rock")==0)

{

Vec3 pos;

pos=entity->GetPosition();

entity->Release();

 

// Create new breakable rock here at pos

}

}

 

I know people have used this hook to create progress bars and I think Josh said that it wasn't intended for that. So I wonder if this is something that might screw up my program. I haven't tried it yet but before I code it in, I was wondering if this would be ok to do.

 

The other option is to use ForEachEntityInAABBDo and specify the entire map. Not sure if that would be slow.

 

Thoughts or other options?

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