Quest: Wack-A-Mole Quest
Challenge: Bullet Time
Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.
Quest: Wack-A-Mole Quest
Challenge: Bullet Time
Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.
There’s a Brackeys Bullet Time tutorial on Youtube that helped with this.
thought I’d just drop a link to my changelog for this quest here
I created a new script, with a panel with a canvas group attached to it.
When you kill a mole, the mole trigger the freezer, the time slows and the panel become blue ice.
Then after x seconds, everything return normal.
(I also wrote a Remap function to map values from a generic time interval to 0-1, so i can use Lerp)
Very creative! I love it.
My first attempt seemed simple enough: use a Coroutine that sets Time.timeScale to 0.5f, waits for a half second, and then resets Time.timeScale to 1f. Unfortunately, when timeScale is slowed, Coroutines stop functioning, so timeScale gets stuck at 0.5f.
The other thing I learned while solving this is that if you adjust timeScale, you also need to adjust Time.fixedDeltaTime. (Watch the 10min Brackeys video for the explanation!) Note that all the numbers in the equations below are arbitrary, and can be adjusted to effect.
public class BulletTime : MonoBehaviour
{
void Update()
{
if (Time.timeScale < 1)
{
Time.timeScale += Time.deltaTime;
}
}
public void SlowTime()
{
Time.timeScale = 0.1f;
Time.fixedDeltaTime = Time.timeScale * 0.02f;
}
}