• 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!

GameMaker Hit Freeze Frames

JeanSwamp

Member
Hello,

I'm trying to find out the best way to implement a hit frame for 0.2/0.5ms whenever a big hit strikes an enemy to create a more impactfull feeling on top of the screenshake. I've seen stuff searching the webs like:

Code:
  var time = current_time , ms = argument0;
   do { } until( ( current_time - time ) >= round( ms ) ) {};
   return ( current_time - time );
But I supose this will also freeze the music and everything else.

How do you guys do it?
 

JeffJ

Member
While not directly related, I always program my games from the very beginning with a custom, global pause function in mind - a variable that all moving instances, timers etc. check before proceeding. The stuff that would let you do something like:

global.gamePaused=true;

... And then everything would freeze instantly - the player would freeze mid-air in his jump, the enemies and their bullets would come to a standstill etc..

On top of that, I also program every speed and timer in the game to be multiplied by my own custom "gamespeed" variable, which is very useful if you want to increase the overall gamespeed for a challenge, or make a bullet time / slow motion effect.

With things like this in place, a freeze frame to emphasize impact like you describe becomes incredibly easy; you could pause the entire game for a split second, or you could turn down the gamespeed to a near standstill for a duration.

However, this assumes that you have taken the necessary precautions. So, how far along are you?

Essentially, what you are wanting is sort of like a global game pause system, it's just localized to a more specific need. With that in mind, if what I've described is out of scope, you could look into generalized pause function tutorials.
 

JeanSwamp

Member
I do have a pause system already

Basically I set global.pause = true;

And for example in my player to carry on where it was left:

Code:
//Pause
    if (global.pause)
    {
        if (last_pause == false)
        {
            original_speed = image_speed;
        }
        image_speed = 0;
        last_pause = global.pause;
        exit;
    }
    else
    {
        if (last_pause == true)
        {
            image_speed = original_speed
        }
        last_pause = global.pause;
    }
 
Last edited:

JeffJ

Member
So then, use that?

If it acts as a true pause system that stops all motion of the player, enemies and other moving parts, then they will automatically be "frozen" until you unpause again. Unless I'm missing something?
 
J

Jonar

Guest
I've found that making all of my visible objects inherit this code works very well. Each object has a script that is held in doStepEvent so I don't need to change the step events of any of the objects that I make.

if !obj_game.pause script_execute(doStepEvent);
else image_speed = 0; // stop animating
 

woods

Member
couldnt you implement a "slow-mo" on critical hit?
set up a timer and set room speed low for a second...?


just a thought ;o)
 
Top