• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Breathing or Heartbeat Indicator (Spriteless!)

tagwolf

Member
Breathing or Heartbeat Indicator (Spriteless!)

GM Version
: 2.X
Target Platform: ALL
Download: N/A
Links: N/A

Summary:
Here's how to make an example breathing indicator for your game where breathing or heart rate might be a mechanic. This can easily be adapted to heart beat by changing the color and the rate, radius, etc. in the available variables.

1587638068531.png

Tutorial:

Here's how to make an example breathing indicator for your game where breathing or heart rate might be a mechanic.

Create one object, I call mine "obj_breathing_indicator"

Create Event
GML:
/// @description Breathing Indicator Variables

breath_indicator_color1 = c_teal;
breath_indicator_color2 = c_blue;
breath_indicator_radius = 100;
breath_indicator_direction = 1;
breath_indicator_pause = false;
breath_indicator_pause_time = 30;
breath_indicator_rate = 0.5;
breath_indicator_inhale_size = 100;
breath_indicator_exhale_size = 65;
Step Event
GML:
/// @description Breathing Indicator Step Logic

if breath_indicator_direction == 1
{
    if breath_indicator_radius >= breath_indicator_inhale_size
    {
        breath_indicator_direction = -1; breath_indicator_pause = true;
    }
}

if breath_indicator_direction == -1
{
    if breath_indicator_radius <= breath_indicator_exhale_size
    {
        breath_indicator_direction = 1; breath_indicator_pause = true;
    }
}

if breath_indicator_pause && breath_indicator_direction = 1
{
    breath_indicator_pause_time -= 1;
}
else
{
    breath_indicator_radius += breath_indicator_direction * breath_indicator_rate;       
}

if breath_indicator_pause_time <= 0
{
    breath_indicator_pause = false;
    breath_indicator_pause_time = 30;
}
Draw Event
GML:
/// @description Draw Breathing Indicator

draw_circle_color(x, y, breath_indicator_radius, breath_indicator_color1, breath_indicator_color2, false);
// uncomment for white outline
//draw_circle_color(x, y, breath_indicator_radius, c_white, c_white, true);
Then just place it in your room where you want it!
 
Top