Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: jedione on January 02, 2017, 08:47:29 AM

Title: custom1 key trigger animation
Post by: jedione on January 02, 2017, 08:47:29 AM
does anyone know how to script this?

when you press a key say custom1 ,,
to make it trigger an animation.

thanks



Title: Re: custom1 key trigger animation
Post by: raygun on January 02, 2017, 09:15:38 AM
this should do it:

Code: [Select]
fe.add_signal_handler("trigger_animation");
function trigger_animation( sig )
{
   if ( sig == "custom1" )
   {

      // insert code for what you want on cistom1 here
      // i.e. animate=true...

      return true;
   }

   return false;
}
Title: Re: custom1 key trigger animation
Post by: jedione on January 02, 2017, 09:44:48 AM
Thanks Raygun.......
---------------------------------------------------------------
Code: [Select]
class PopUpImage
{
        _my_image=null;

        constructor()
        {
                _my_image = fe.add_artwork( "snap", flx*0.200, fly*0.200, flw*0.100, flh*0.100 );
                _my_image.visible=false;
                fe.add_signal_handler( this, "on_signal" )
        }

        function on_signal( signal )
        {
                if ( signal == "custom1" )
                {
                        _my_image.visible=!_my_image.visible;
                        return true;
                }
                return false;
        }
}

local blah = PopUpImage();
this works great....
going to play with it and add animation to it...