Code from the video: Create event: hitBlinkTime = 10; hitBlinkTimer = hitBlinkTime; // the timer that runs down hitAlpha = 0.4; // the alpha to blink between 1 and 0.4 Step event: // only blink when in the "hit" state if(state == "hit"){ // run down timer, if 0 or lower, reset timer hitBlinkTimer--; if(hitBlinkTimer
This is a nice script for this and has many other uses! :) function blink(on_val, off_val, rate) { on_val = argument[0]; off_val = argument[1]; rate = (argument_count > 2 ? (argument[2] * 1000) : 1000); if (current_time % (rate * 2) >= rate) return on_val; return off_val; }
Code from the video:
Create event:
hitBlinkTime = 10;
hitBlinkTimer = hitBlinkTime; // the timer that runs down
hitAlpha = 0.4; // the alpha to blink between 1 and 0.4
Step event:
// only blink when in the "hit" state
if(state == "hit"){
// run down timer, if 0 or lower, reset timer
hitBlinkTimer--;
if(hitBlinkTimer
This is a nice script for this and has many other uses! :)
function blink(on_val, off_val, rate)
{
on_val = argument[0];
off_val = argument[1];
rate = (argument_count > 2 ? (argument[2] * 1000) : 1000);
if (current_time % (rate * 2) >= rate) return on_val;
return off_val;
}
Thanks for sharing, also a neat way to do the same thing.
@@1upIndie you're welcome. :)