To construct an animation that only plays once a Trigger has been received, follow these steps:
- In the Hierarchy window, create an empty GameObject named water-block-container, positioned at (2.5, -4, 0). This empty GameObject will allow us to make duplicates of animated water blocks that will animate relative to their parent GameObject's position.
- Drag an instance of the Water Block sprite from the Project | Sprites folder into the scene and make it a child of the water-block-container GameObject. Ensure the position of your new child Water Block GameObject is (0, 0, 0) so that it appears neatly to the right of the wall blocks platform:
Figure 6.34 – Dragging the Water Block sprite to the scene and ensuring its position is (0,0,0)
- Add a Box Collider 2D component to the child Water Block GameObject. Set the layer of this GameObject to Ground so that the player's character can stand and jump on...