G
GrAmmErX
Guest
I know that i can make this by using the alarms but i dont know how, i want to make a platform that is visible and solid for about 1.5/2 sec then it disappears and then appears again, can someone help me ?
Thank you very much for the quick respondCreate event:
Alarm 0 event:Code:alarm[0] = room_speed * 2; // 2 seconds
Code:solid = !solid; visible = !visible; alarm[0] = room_speed * 2; // 2 seconds
//CREATE EVENT
platform_disappear = 90 //1.5sec based on room speed of 60
platform_reappear = 90 //1.5sec based on room speed of 60
if ( image_alpha == 1 )
{
platform_disappear -= 1; //Start the timer
if ( platform_disappear <= 0 )
{
image_alpha -= 0.05 // Platform will fade out
if ( image_alpha <= 0 )
{
image_alpha = 0;
platform_disappear = 90; //Reset the timer
}
}
}
if ( image_alpha == 0 )
{
platform_reappear -= 1; //Start the timer
if ( platform_reappear <= 0 )
{
image_alpha += 0.05 // Platform will fade in
if ( image_alpha <= 1 )
{
image_alpha = 1;
platform_reappear = 90; //Reset the timer
}
}
}
Thanks a lot for your advice i will try it nowHow are you?
The first piece of advice I give to people when I see alarms...don't use the built-in alarm system. I'm not saying they are bad or don't work, I just find them really hard to keep track off as they aren't descriptive enough (alarm[0], alarm[1] etc..)
To answer your problem create 2 variables, one for making the platform disappear, the other for reappearing. (These will act as your timers)
I'm not too sure what you mean by disappear (just fade out, then fade back in again, or remove from the game and add in again), but in the step event add this code:Code://CREATE EVENT platform_disappear = 90 //1.5sec based on room speed of 60 platform_reappear = 90 //1.5sec based on room speed of 60
Code:if ( image_alpha == 1 ) { platform_disappear -= 1; //Start the timer if ( platform_disappear <= 0 ) { image_alpha -= 0.05 // Platform will fade out if ( image_alpha <= 0 ) { image_alpha = 0; platform_disappear = 90; //Reset the timer } } } if ( image_alpha == 0 ) { platform_reappear -= 1; //Start the timer if ( platform_reappear <= 0 ) { image_alpha += 0.05 // Platform will fade in if ( image_alpha <= 1 ) { image_alpha = 1; platform_reappear = 90; //Reset the timer } } }