
Hedge Cannon
Designed to challenge the player's timing and positioning with randomized patterns and layered hazards.
Alternating Cannon Fire:
The trap consists of three rows of cannons—left, middle, and right—that alternate firing. Each row shoots a vertical stack of three balls, making it impossible for the player to jump over or duck under the hazard.
Player Reset Mechanic:
Each ball has a trigger box attached to it. If a ball collides with the player, the script instantly teleports them back to the beginning of the trap. This penalty reinforces the importance of strategic movement and timing.
Dynamic Animation with Timelines:
The balls are animated using three separate timelines—one for each row. Each timeline includes vector tracks that move the balls to the end of the maze. To reset the balls seamlessly, the script calls a function at the end of the timeline that manually repositions the balls at their starting location. This approach avoids the perpetual looping behavior of default timelines, which would compromise the trap’s functionality.
Randomized Fire Delay:
To prevent predictability, the script introduces a random float delay of 0 to 0.5 seconds between shots. This keeps the player on their toes, as they cannot rely on rigid timing to navigate the trap.
Terrain Hazards:
The landscape within the trap area features holes that add another layer of challenge. Falling into a hole triggers another teleportation mechanism, sending the player back to the beginning of the trap.
Performance Considerations:
Each set of balls (left, right, middle) are individually controllable, which offers precise timing and movement customization. While this design prioritizes flexibility, consolidating some logic into shared timelines might reduce overall complexity in larger projects. However, the current approach strikes a balance between performance and the dynamic nature of the challenge.




