Skip to content

xintegrate-studios/cwu-breathing-mechanic

Repository files navigation

cwu-breathing-mechanic

image

A test project where I made my breathing mechanic for my game about sleep paralysis, CAN’T WAKE UP (cwu).

During an in-game paralysis episode, the player has to manually control their breathing by holding and releasing the spacebar at a slow, steady pace. You have to feel the rhythm and stay calm while everything else in the scene is trying to distract or scare you. If the player rushes their breathing, hesitates for too long, or falls out of sync, the system treats it as panic/a fail, and the episode ends badly (i.e. monster jumpscare). The goal is to turn something automatic into something tense and deliberate, forcing the player to stay composed under pressure.

How to Use

since yall couldn't figure it out

Inhaling and Exhaling

SKRILLEX REFERENCE????

Use the spacebar to inhale and exhale. You can inhale by pressing the spacebar and exhale by releasing. Upon project startup, you will automatically be exhaling (you can see what breathing phase you're currently in by checking the phase: label in the UI. For example, if the spacebar is being pressed at any time, then the label will show phase: inhale, as seen below:

image

Timing your Breaths

As mentioned before, you will need to time your breaths correctly. There is a certain amount of time you need to press/release the spacebar for before you switch phases. This amount of time is called the breath interval, and is currently set to 2.5 seconds. When this timer runs out, a new timer starts. This one is called the accuracy gap, and is currently set to 0.7 seconds. This is the amount of time you have to switch breath phases (i.e. press/release the spacebar).

image

You can see the timers in action by looking at these pink labels:

image

Depending on how late/early your input is, the ACCURACY: and AVG: labels will update accordingly.

image

Failing

Player switches phases too early

If you switch phases before the accuracy gap timer starts (while the breath interval timer is still running), the system will count it as a failure, then skip the accuracy gap timer and automatically start the next breath phase. For example, if the spacebar isn't being pressed (exhaling) and the breath interval timer is at 0.4 seconds, and then the spacebar is pressed, the system will skip to an automatic inhale, disregarding the 0.7-second accuracy gap, and add +1 to the FAILS: counter. An example of this is shown in the clip below.

Recording.2026-01-04.151825.mp4

Player doesn't switch phases

If the accuracy gap timer runs out and no switch of phases (press/release) is detected, the system will count it as a failure and restart the current phase, as seen in the clip below:

Recording.2026-01-04.153204.mp4

About

A test project where I made my breathing mechanic for my game about sleep paralysis, CAN’T WAKE UP (cwu).

Resources

License

Stars

Watchers

Forks

Contributors