Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: jedione on March 17, 2017, 07:01:11 AM
-
How would i set up so that if i "left key",, does my animation
but then "right key" only trigger's my second animation
anyone...thanks
-
im thinking it would be somthing like this
local move_cfg = {
property = "x",
start = 250,
end = 300,
time = 1500,
when = function( left ) {
left.function==
some function goes here,,
}
-
Why you dont try to add
fe.add_signal_handler( this, "on_signal" );
function on_signal( sig )
{
switch ( sig )
{
case "right:"
//Add your animation for the right
case "left:"
//Add your animation for the left
-
cant seem to get it to work...
-
this should work, but don't ahh
fe.add_signal_handler("trigger_animation");
function trigger_animation( sig )
{
if ( sig == "custom2" )
{
::OBJECTS <- {
l = fe.add_artwork("snap" , flx*-0.600, fly*0.230, flw*0.600, flh*0.600),
}
local console = {
when =Transition.ToNewSelection ,
property = "x",
start = flx*0.850,
end = flx*0.200,
time = 0500,
}
animation.add( PropertyAnimation( OBJECTS.l, console ) );
OBJECTS.l.preserve_aspect_ratio = true;
animate=true;
return true;
}
return false;
}
-
This is from Arcade Color Theme and worked for me:
::OBJECTS2 <- {
obg = fe.add_image ("black.png",0,0,flw, flh),
osbg = fe.add_image ("white.png", flx*0.249,fly*0.187,flw*0.501, flh*0.667),
osbg2 = fe.add_image("black.png", flx*0.252,fly*0.19,flw*0.496, flh*0.66),
osnap = fe.add_artwork("snap", flx*0.252,fly*0.19,flw*0.496, flh*0.66),
oshadow = fe.add_image("oshadow.png", flx*0.252,fly*0.19,flw*0.496, flh*0.66),
oTitle = fe.add_text("[Title] ([Year])",flx*0.26, fly*0.2, flw*0.47, flh*0.03),
oPreviewbg = fe.add_image("previewbg.png", flx*0.755,fly*0.19,flw*0.03, flh*0.05),
oPreview = fe.add_image("preview.png", flx*0.755,fly*0.19,flw*0.03, flh*0.05),
}
OBJECTS2.osbg.set_rgb( bgRed, bgGreen, bgBlue );
OBJECTS2.osnap.trigger = Transition.EndNavigation;
OBJECTS2.osnap.preserve_aspect_ratio = true;
OBJECTS2.oTitle.align = Align.Left;
OBJECTS2.oTitle.font="Arial";
OBJECTS2.oPreview.set_rgb( bgRed, bgGreen, bgBlue );
OBJECTS2.obg.visible=false;
OBJECTS2.osbg.visible=false;
OBJECTS2.osbg2.visible=false;
OBJECTS2.osnap.visible=false;
OBJECTS2.oshadow.visible=false;
OBJECTS2.oTitle.visible=false;
OBJECTS2.oPreview.visible=false;
OBJECTS2.oPreviewbg.visible=false;
class displayPreview{
_trigger="Custom1";
constructor()
{
fe.add_signal_handler( this, "on_signal" )
_trigger=fe.get_config()["preview"].tolower();
}
function on_signal( signal )
{
if ( signal == _trigger )
{
local previewClick = fe.add_sound("previewClick.mp3")
previewClick.playing=true
display_preview();
return true;
}
return false;
}
}
displayPreview();
function display_preview()
{
if (OBJECTS2.obg.visible == false) {
OBJECTS2.obg.visible=true;
OBJECTS2.osbg.visible=true;
OBJECTS2.osbg2.visible=true;
OBJECTS2.osnap.visible=true;
OBJECTS2.oshadow.visible=true;
OBJECTS2.oTitle.visible=true;
OBJECTS2.oPreview.visible=true;
OBJECTS2.oPreviewbg.visible=true;
local move_ogb = {
property = "alpha", start = 210 end = 210, time = 1
}
local move_osbg_y = {
property = "y", start = fly*2 end = fly*0.186, time = 300
}
local move_osbg2_y = {
property = "y", start = fly*2 end = fly*0.19, time = 300
}
local move_osnap_y = {
property = "y", start = fly*2 end = fly*0.19, time = 300
}
local move_oshadow_y = {
property = "y", start = fly*2 end = fly*0.19, time = 300
}
local move_oTitle_y = {
property = "y", start = fly*2 end = fly*0.2, time = 300
}
local move_oPreview_y = {
property = "y", start = fly*2 end = fly*0.165, time = 300
}
animation.add( PropertyAnimation( OBJECTS2.obg, move_ogb ) );
animation.add( PropertyAnimation( OBJECTS2.osbg, move_osbg_y ) );
animation.add( PropertyAnimation( OBJECTS2.osbg2, move_osbg2_y ) );
animation.add( PropertyAnimation( OBJECTS2.osnap, move_osnap_y ) );
animation.add( PropertyAnimation( OBJECTS2.oshadow, move_oshadow_y ) );
animation.add( PropertyAnimation( OBJECTS2.oTitle, move_oTitle_y ) );
animation.add( PropertyAnimation( OBJECTS2.oPreview, move_oPreview_y ) );
animation.add( PropertyAnimation( OBJECTS2.oPreviewbg, move_oPreview_y ) );
}
else if (OBJECTS2.obg.visible == true) {
OBJECTS2.obg.visible=false;
OBJECTS2.osbg.visible=false;
OBJECTS2.osbg2.visible=false;
OBJECTS2.osnap.visible=false;
OBJECTS2.oshadow.visible=false;
OBJECTS2.oTitle.visible=false;
OBJECTS2.oPreview.visible=false;
OBJECTS2.oPreviewbg.visible=false;
}
}
-
thanks, ill try this..for one of my theme's
-
Sorry maybe im late to reply (im was on vacations),
try to use when = 100 (this means always), so always you are going to trigger the animation, hope this helps you.