Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create a default render property with a boulder sprite
- RenderProperty* defaultRenderProperty = new RenderProperty(); // Create a Default RenderProperty
- defaultRenderProperty->frames.push_back(&mTheApp->mTileTextureManager["boulder"]); // With the boulder texture
- defaultRenderProperty->visible = true; // Visible by default
- mTheApp->mDefaultProperties.push_front(defaultRenderProperty); // Add it to the default properties list so we can delete it in the destructor
- // Create a boulder prototype
- Prototype boulder(mTheApp->mNextEntityID);
- boulder.mTheApp = mTheApp; // Link it to the app
- boulder.AddSystem(mTheApp->mAnimationSystem); // Add the Animation System so it's visible
- boulder.AddDefaultProperty(RENDER, defaultRenderProperty); // Assign the property to the prototype
- // Add the prototype to the list
- mTheApp->mPrototypes.insert(std::make_pair("boulder",boulder));
- // Change the prototype we'll place on a tile
- mPlacementPrototype = &mTheApp->mPrototypes.find("boulder")->second;
- // Make a new Instance
- InstanceID newEntity = mPlacementPrototype->MakeInstance();
- // Add it to the clicked tile
- clickedTile->AddEntity(newEntity, true);
- // Get a modifiable pointer to the properties so we can make changes
- RenderProperty* entityRenderProps = mTheApp.mRenderProperties.Get(newEntity);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement