Build A Platformer Level Using Prefabs
Now that you’ve created entities that move back and forth between targets, it’s time to build a prefab you can use to quickly set up your own level.
Creating the Prefab
To start, you’ll need to define the set of entities that make up your moving entity. Each set will have multiple entities. The first entity will represent the platform itself, while other entities will represent the destinations the platform will move to. Follow these steps to create your resetting platform prefab:
- Add an entity to your scene named
AnimatingBlockSet. For how to add entities and components to your scene, see Working with Entities and Components. - Add another entity named
AnimatingBlockto your scene as a child of theAnimatingBlockSet. Set this entity’s transform to the parent’s transform. This is the entity that will animate. - Add a
mesh_componentto your AnimatingBlock and assign it the cube. - Add an
animate_to_targets_componentand akeyframed_movement_componentto theAnimatingBlock. This is the Verse component you defined earlier. - Add three new entities to the scene named
StartingTarget,Target2, andTarget3, and set them as children of theAnimatingBlockSet. Add themesh_componentto each of them and set it to sphere. This will allow you to visualize where your entity is moving in the world.
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.