Here's some suggested modifications to your code to improve the animations.
The Agent buttons should be called as button and not switches in order to be animated properly and the order of the images reversed, with a slightly smaller footprint than the hole itself.
Same applies to the test button, I recreated a "hole" by adding larger black circles in canvas beneath the buttons and shrinking a bit the test buttons.
Lastly, I suggest to use the images below for the pushed button resource (ideally the text itself should be shifted by a few pixels to the right and down) as direct replacement for
" so the depth effect is reinforced. Note that "DISCH" should be in the Futura medium condensed font as per EATON/Airbus specifications (comme on dit, " qui peut le plus peut le moins"
(search for : futura_medium_condensed_bt.ttf and place the font in the resource folder, then modify the code accordingly if you wish)
Still a WIP, the 3 graphic resources for the FIRE pushbuttons animation are still missing, namely:
1- a lighted FIRE button, a lighted FIRE button released (ideally x2: one with 4 bulbs, and the other with 8 bulbs lighted, but I am not sure this feature has been implemented in the FBW mod)
Tell me what you think, le Diable est dans les détails.
Code: Select all
--====================================================================================
-- Airbus A32NX FlyByWire for Air Manager
-- Author: Thierry Huguet (Scarabee78 on Siminnovation forum)
-- Date: Aout 2021
-- Last tested: Built 2021-08-11T07:29:20+00:00
-- modified version by Jacques Zahar
--====================================================================================
--- Images ---
ImgBackground = img_add_fullscreen("OH-Fire.png")
Fire_ENG1 = img_add("Grille3.png",172,67,215,150)
Fire_ENG2 = img_add("Grille3.png",913,67,215,150)
Fire_APU = img_add("Grille3.png",541,37,215,150)
--- Variables importées ---
local lvar_acbus = {"L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED","num"}
local lvar_eng1agent1 = {"L:A32NX_FIRE_ENG1_AGENT1_Discharge","num"}
local lvar_eng1agent2 = {"L:A32NX_FIRE_ENG1_AGENT2_Discharge","num"}
local lvar_apuagent1 = {"L:A32NX_FIRE_APU_AGENT1_Discharge","num"}
local lvar_eng2agent1 = {"L:A32NX_FIRE_ENG2_AGENT1_Discharge","num"}
local lvar_eng2agent2 = {"L:A32NX_FIRE_ENG2_AGENT2_Discharge","num"}
local lvar_SWannlt = {"L:A32NX_OVHD_INTLT_ANN","num"}
--- Events actionnés ---
local event_eng1test = {"L:A32NX_FIRE_TEST_ENG1","num"}
local event_eng2test = {"L:A32NX_FIRE_TEST_ENG2","num"}
local event_aputest = {"L:A32NX_FIRE_TEST_APU","num"}
--- Fonctions ---
function Lire_boutons(acbus,eng1agent1,eng2agent2,SWannlt)
visible(eng1agent1_light_on,acbus==1 and SWannlt==0)
visible(eng1agent2_light_on,acbus==1 and SWannlt==0)
visible(eng1agent1_SQUIB,acbus==1 and SWannlt==0)
visible(eng1agent2_SQUIB,acbus==1 and SWannlt==0)
visible(eng2agent1_light_on,acbus==1 and SWannlt==0)
visible(eng2agent2_light_on,acbus==1 and SWannlt==0)
visible(eng2agent1_SQUIB,acbus==1 and SWannlt==0)
visible(eng2agent2_SQUIB,acbus==1 and SWannlt==0)
visible(apuagent_light_on,acbus==1 and SWannlt==0)
visible(apuagent_SQUIB,acbus==1 and SWannlt==0)
end
function push_eng1test()
fs2020_variable_write(event_eng1test[1],event_eng1test[2],1)
visible(eng1agent1_light_on,1)
visible(eng1agent2_light_on,1)
visible(eng1agent1_SQUIB,1)
visible(eng1agent2_SQUIB,1)
end
function release_eng1test()
fs2020_variable_write(event_eng1test[1],event_eng1test[2],0)
visible(eng1agent1_light_on,0)
visible(eng1agent2_light_on,0)
visible(eng1agent1_SQUIB,0)
visible(eng1agent2_SQUIB,0)
end
function push_eng2test()
fs2020_variable_write(event_eng2test[1],event_eng2test[2],1)
visible(eng2agent1_light_on,1)
visible(eng2agent2_light_on,1)
visible(eng2agent1_SQUIB,1)
visible(eng2agent2_SQUIB,1)
end
function release_eng2test()
fs2020_variable_write(event_eng2test[1],event_eng2test[2],0)
visible(eng2agent1_light_on,0)
visible(eng2agent2_light_on,0)
visible(eng2agent1_SQUIB,0)
visible(eng2agent2_SQUIB,0)
end
function push_aputest()
fs2020_variable_write(event_aputest[1],event_aputest[2],1)
visible(apuagent_light_on,1)
visible(apuagent_SQUIB,1)
end
function release_aputest()
fs2020_variable_write(event_aputest[1],event_aputest[2],0)
visible(apuagent_light_on,0)
visible(apuagent_SQUIB,0)
end
-------------------------------------
function Eng1_agent1_pressed()
-- insert command here
end
function Eng1_agent1_released()
-- insert command here
end
function Eng1_agent2_pressed()
-- insert command here
end
function Eng1_agent2_released()
-- insert command here
end
function Eng2_agent1_pressed()
-- insert command here
end
function Eng2_agent1_released()
-- insert command here
end
function Eng2_agent2_pressed()
-- insert command here
end
function Eng2_agent2_released()
-- insert command here
end
function APU_agent_pressed()
-- insert command here
end
function APU_agent2_released()
-- insert command here
end
--- Boutons ---
push_eng1_agent1 = button_add("DISCH_out.png","DISCH_in.png",78,50,56,56, Eng1_agent1_pressed, Eng1_agent1_released)
push_eng1_agent2 = button_add("DISCH_out.png","DISCH_in.png",432,50,56,56,Eng1_agent2_pressed, Eng1_agent2_released)
push_eng2_agent1 = button_add("DISCH_out.png","DISCH_in.png",803,50,56,56,Eng2_agent1_pressed, Eng2_agent1_released)
push_eng2_agent2 = button_add("DISCH_out.png","DISCH_in.png",1160,50,56,56,Eng2_agent2_pressed, Eng2_agent2_released)
push_apu_agent = button_add("DISCH_out.png","DISCH_in.png",527,156,56,56,APU_agent_pressed, APU_agent_released)
-- Trous sous les boutons test
canvas_add(0,0,1300,219,function()
_circle(104,150,18)
_circle(737,185,18)
_circle(1200,150,18)
_fill("black")
end)
push_eng1_test = button_add("test.png",nil,90,136,30,30,push_eng1test,release_eng1test)
push_apu_test = button_add("test.png",nil,724,171,30,30,push_aputest,release_aputest)
push_eng2_test = button_add("test.png",nil,1187,136,30,30,push_eng2test,release_eng2test)
--- Lumieres ---
eng1agent1_light_on = img_add("DISCH_on.png",80,50,56,56)
visible(eng1agent1_light_on,false)
eng1agent2_light_on = img_add("DISCH_on.png",432,50,56,56)
visible(eng1agent2_light_on,false)
eng1agent1_SQUIB = txt_add("SQUIB", "font:arimo_bold.ttf; size:16; color: #f9f6e6; halign:center;", 66,58, 80,30)
visible(eng1agent1_SQUIB,false)
eng1agent2_SQUIB = txt_add("SQUIB", "font:arimo_bold.ttf; size:16; color: #f9f6e6; halign:center;", 420,58, 80,30)
visible(eng1agent2_SQUIB,false)
eng2agent1_light_on = img_add("DISCH_on.png",803,50,56,56)
visible(eng2agent1_light_on,false)
eng2agent2_light_on = img_add("DISCH_on.png",1160,50,56,56)
visible(eng2agent2_light_on,false)
eng2agent1_SQUIB = txt_add("SQUIB", "font:arimo_bold.ttf; size:16; color: #f9f6e6; halign:center;", 792,58, 80,30)
visible(eng2agent1_SQUIB,false)
eng2agent2_SQUIB = txt_add("SQUIB", "font:arimo_bold.ttf; size:16; color: #f9f6e6; halign:center;", 1149,58, 80,30)
visible(eng2agent2_SQUIB,false)
apuagent_light_on = img_add("DISCH_on.png",527,156,56,56)
visible(apuagent_light_on,false)
apuagent_SQUIB = txt_add("SQUIB", "font:futura_medium_condensed_bt.ttf; size:22; color: #f9f6e6; halign:center;", 516,164, 80,30)-- font & size modified fort testing purpose
visible(apuagent_SQUIB,false)
-- Force a callback. The 'Lire_boutons' function will be called here with its current arguments.
request_callback(Lire_boutons)
--- Mise à jour variables ---
fs2020_variable_subscribe(lvar_acbus[1],lvar_acbus[2],
lvar_eng1agent1[1], lvar_eng1agent1[2],
lvar_eng1agent2[1], lvar_eng1agent2[2],
lvar_SWannlt[1], lvar_SWannlt[2], Lire_boutons)