Advertisement
Guest User

Untitled

a guest
Nov 15th, 2012
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | None | 0 0
  1. // Create a default render property with a boulder sprite
  2. RenderProperty* defaultRenderProperty = new RenderProperty(); // Create a Default RenderProperty
  3. defaultRenderProperty->frames.push_back(&mTheApp->mTileTextureManager["boulder"]); // With the boulder texture
  4. defaultRenderProperty->visible = true; // Visible by default
  5. mTheApp->mDefaultProperties.push_front(defaultRenderProperty); // Add it to the default properties list so we can delete it in the destructor
  6.  
  7. // Create a boulder prototype
  8. Prototype boulder(mTheApp->mNextEntityID);
  9. boulder.mTheApp = mTheApp; // Link it to the app
  10. boulder.AddSystem(mTheApp->mAnimationSystem); // Add the Animation System so it's visible
  11. boulder.AddDefaultProperty(RENDER, defaultRenderProperty); // Assign the property to the prototype
  12.  
  13. // Add the prototype to the list
  14. mTheApp->mPrototypes.insert(std::make_pair("boulder",boulder));
  15.  
  16. // Change the prototype we'll place on a tile
  17. mPlacementPrototype = &mTheApp->mPrototypes.find("boulder")->second;
  18.  
  19. // Make a new Instance
  20. InstanceID newEntity = mPlacementPrototype->MakeInstance();
  21. // Add it to the clicked tile
  22. clickedTile->AddEntity(newEntity, true);
  23.  
  24. // Get a modifiable pointer to the properties so we can make changes
  25. RenderProperty* entityRenderProps = mTheApp.mRenderProperties.Get(newEntity);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement