revamped key rebinding system

This commit is contained in:
2025-06-06 11:11:52 +10:00
parent 4a21701a35
commit c44a730b59
1547 changed files with 6435 additions and 17228 deletions
Assets/Textures
Classes
KennyControllerPrompts
Mouse
Playstation
controller_playstation1.pngcontroller_playstation1.png.importcontroller_playstation2.pngcontroller_playstation2.png.importcontroller_playstation3.pngcontroller_playstation3.png.importcontroller_playstation4.pngcontroller_playstation4.png.importcontroller_playstation5.pngcontroller_playstation5.png.importplaystation3_button_select.pngplaystation3_button_select.png.importplaystation3_button_select_outline.pngplaystation3_button_select_outline.png.importplaystation3_button_start.pngplaystation3_button_start.png.importplaystation3_button_start_outline.pngplaystation3_button_start_outline.png.importplaystation4_button_options.pngplaystation4_button_options.png.importplaystation4_button_options_outline.pngplaystation4_button_options_outline.png.importplaystation4_button_share.pngplaystation4_button_share.png.importplaystation4_button_share_outline.pngplaystation4_button_share_outline.png.importplaystation4_touchpad.pngplaystation4_touchpad.png.importplaystation4_touchpad_outline.pngplaystation4_touchpad_outline.png.importplaystation4_touchpad_press.pngplaystation4_touchpad_press.png.importplaystation4_touchpad_press_center.pngplaystation4_touchpad_press_center.png.importplaystation4_touchpad_press_left.pngplaystation4_touchpad_press_left.png.importplaystation4_touchpad_press_right.pngplaystation4_touchpad_press_right.png.importplaystation4_touchpad_selected.pngplaystation4_touchpad_selected.png.importplaystation4_touchpad_swipe_down.pngplaystation4_touchpad_swipe_down.png.importplaystation4_touchpad_swipe_horizontal.pngplaystation4_touchpad_swipe_horizontal.png.importplaystation4_touchpad_swipe_left.pngplaystation4_touchpad_swipe_left.png.importplaystation4_touchpad_swipe_right.pngplaystation4_touchpad_swipe_right.png.importplaystation4_touchpad_swipe_up.pngplaystation4_touchpad_swipe_up.png.importplaystation4_touchpad_swipe_vertical.pngplaystation4_touchpad_swipe_vertical.png.importplaystation4_touchpad_touch.pngplaystation4_touchpad_touch.png.importplaystation4_touchpad_touch_outline.pngplaystation4_touchpad_touch_outline.png.importplaystation5_button_create.pngplaystation5_button_create.png.importplaystation5_button_create_alternative.pngplaystation5_button_create_alternative.png.importplaystation5_button_create_alternative_outline.pngplaystation5_button_create_alternative_outline.png.importplaystation5_button_create_outline.pngplaystation5_button_create_outline.png.importplaystation5_button_mute.pngplaystation5_button_mute.png.importplaystation5_button_mute_outline.pngplaystation5_button_mute_outline.png.importplaystation5_button_options.pngplaystation5_button_options.png.importplaystation5_button_options_alternative.pngplaystation5_button_options_alternative.png.importplaystation5_button_options_alternative_outline.pngplaystation5_button_options_alternative_outline.png.importplaystation5_button_options_outline.pngplaystation5_button_options_outline.png.importplaystation5_elite_fn_l.pngplaystation5_elite_fn_l.png.importplaystation5_elite_fn_l_outline.pngplaystation5_elite_fn_l_outline.png.importplaystation5_elite_fn_r.pngplaystation5_elite_fn_r.png.importplaystation5_elite_fn_r_outline.pngplaystation5_elite_fn_r_outline.png.importplaystation5_elite_lb.pngplaystation5_elite_lb.png.importplaystation5_elite_lb_outline.pngplaystation5_elite_lb_outline.png.importplaystation5_elite_rb.pngplaystation5_elite_rb.png.importplaystation5_elite_rb_outline.pngplaystation5_elite_rb_outline.png.importplaystation5_touchpad.pngplaystation5_touchpad.png.importplaystation5_touchpad_outline.pngplaystation5_touchpad_outline.png.importplaystation5_touchpad_press.pngplaystation5_touchpad_press.png.importplaystation5_touchpad_press_center.pngplaystation5_touchpad_press_center.png.importplaystation5_touchpad_press_left.pngplaystation5_touchpad_press_left.png.importplaystation5_touchpad_press_right.pngplaystation5_touchpad_press_right.png.importplaystation5_touchpad_selected.pngplaystation5_touchpad_selected.png.importplaystation5_touchpad_swipe_down.pngplaystation5_touchpad_swipe_down.png.importplaystation5_touchpad_swipe_horizontal.pngplaystation5_touchpad_swipe_horizontal.png.importplaystation5_touchpad_swipe_left.pngplaystation5_touchpad_swipe_left.png.importplaystation5_touchpad_swipe_right.pngplaystation5_touchpad_swipe_right.png.importplaystation5_touchpad_swipe_up.pngplaystation5_touchpad_swipe_up.png.importplaystation5_touchpad_swipe_vertical.pngplaystation5_touchpad_swipe_vertical.png.importplaystation5_touchpad_touch.pngplaystation5_touchpad_touch.png.importplaystation5_touchpad_touch_outline.pngplaystation5_touchpad_touch_outline.png.importplaystation_button_analog.pngplaystation_button_analog.png.importplaystation_button_analog_outline.pngplaystation_button_analog_outline.png.importplaystation_button_circle.pngplaystation_button_circle.png.importplaystation_button_circle_outline.pngplaystation_button_circle_outline.png.importplaystation_button_color_circle.pngplaystation_button_color_circle.png.importplaystation_button_color_circle_outline.pngplaystation_button_color_circle_outline.png.importplaystation_button_color_cross.pngplaystation_button_color_cross.png.importplaystation_button_color_cross_outline.pngplaystation_button_color_cross_outline.png.importplaystation_button_color_square.pngplaystation_button_color_square.png.importplaystation_button_color_square_outline.pngplaystation_button_color_square_outline.png.importplaystation_button_color_triangle.pngplaystation_button_color_triangle.png.importplaystation_button_color_triangle_outline.pngplaystation_button_color_triangle_outline.png.importplaystation_button_cross.pngplaystation_button_cross.png.importplaystation_button_cross_outline.pngplaystation_button_cross_outline.png.importplaystation_button_l3.pngplaystation_button_l3.png.importplaystation_button_l3_outline.pngplaystation_button_l3_outline.png.importplaystation_button_r3.pngplaystation_button_r3.png.importplaystation_button_r3_outline.pngplaystation_button_r3_outline.png.importplaystation_button_square.pngplaystation_button_square.png.importplaystation_button_square_outline.pngplaystation_button_square_outline.png.importplaystation_button_triangle.pngplaystation_button_triangle.png.importplaystation_button_triangle_outline.pngplaystation_button_triangle_outline.png.importplaystation_dpad.pngplaystation_dpad.png.importplaystation_dpad_all.pngplaystation_dpad_all.png.importplaystation_dpad_down.pngplaystation_dpad_down.png.importplaystation_dpad_down_outline.pngplaystation_dpad_down_outline.png.importplaystation_dpad_horizontal.pngplaystation_dpad_horizontal.png.importplaystation_dpad_horizontal_outline.pngplaystation_dpad_horizontal_outline.png.importplaystation_dpad_left.pngplaystation_dpad_left.png.importplaystation_dpad_left_outline.pngplaystation_dpad_left_outline.png.importplaystation_dpad_none.pngplaystation_dpad_none.png.importplaystation_dpad_right.pngplaystation_dpad_right.png.importplaystation_dpad_right_outline.pngplaystation_dpad_right_outline.png.importplaystation_dpad_up.pngplaystation_dpad_up.png.importplaystation_dpad_up_outline.pngplaystation_dpad_up_outline.png.importplaystation_dpad_vertical.pngplaystation_dpad_vertical.png.importplaystation_dpad_vertical_outline.pngplaystation_dpad_vertical_outline.png.importplaystation_stick_l.pngplaystation_stick_l.png.importplaystation_stick_l_down.pngplaystation_stick_l_down.png.importplaystation_stick_l_horizontal.pngplaystation_stick_l_horizontal.png.importplaystation_stick_l_left.pngplaystation_stick_l_left.png.importplaystation_stick_l_press.pngplaystation_stick_l_press.png.importplaystation_stick_l_right.pngplaystation_stick_l_right.png.importplaystation_stick_l_up.pngplaystation_stick_l_up.png.importplaystation_stick_l_vertical.pngplaystation_stick_l_vertical.png.importplaystation_stick_r.pngplaystation_stick_r.png.importplaystation_stick_r_down.pngplaystation_stick_r_down.png.importplaystation_stick_r_horizontal.pngplaystation_stick_r_horizontal.png.importplaystation_stick_r_left.pngplaystation_stick_r_left.png.importplaystation_stick_r_press.pngplaystation_stick_r_press.png.importplaystation_stick_r_right.pngplaystation_stick_r_right.png.importplaystation_stick_r_up.pngplaystation_stick_r_up.png.importplaystation_stick_r_vertical.pngplaystation_stick_r_vertical.png.importplaystation_stick_side_l.pngplaystation_stick_side_l.png.importplaystation_stick_side_r.pngplaystation_stick_side_r.png.importplaystation_stick_top_l.pngplaystation_stick_top_l.png.importplaystation_stick_top_r.pngplaystation_stick_top_r.png.importplaystation_trigger_l1.pngplaystation_trigger_l1.png.importplaystation_trigger_l1_alternative.pngplaystation_trigger_l1_alternative.png.importplaystation_trigger_l1_alternative_outline.pngplaystation_trigger_l1_alternative_outline.png.importplaystation_trigger_l1_outline.pngplaystation_trigger_l1_outline.png.importplaystation_trigger_l2.pngplaystation_trigger_l2.png.importplaystation_trigger_l2_alternative.pngplaystation_trigger_l2_alternative.png.importplaystation_trigger_l2_alternative_outline.pngplaystation_trigger_l2_alternative_outline.png.importplaystation_trigger_l2_outline.pngplaystation_trigger_l2_outline.png.importplaystation_trigger_r1.pngplaystation_trigger_r1.png.importplaystation_trigger_r1_alternative.pngplaystation_trigger_r1_alternative.png.importplaystation_trigger_r1_alternative_outline.pngplaystation_trigger_r1_alternative_outline.png.importplaystation_trigger_r1_outline.pngplaystation_trigger_r1_outline.png.importplaystation_trigger_r2.pngplaystation_trigger_r2.png.importplaystation_trigger_r2_alternative.pngplaystation_trigger_r2_alternative.png.importplaystation_trigger_r2_alternative_outline.pngplaystation_trigger_r2_alternative_outline.png.importplaystation_trigger_r2_outline.pngplaystation_trigger_r2_outline.png.import
Xbox
controller_xbox360.pngcontroller_xbox360.png.importcontroller_xbox_adaptive.pngcontroller_xbox_adaptive.png.importcontroller_xboxone.pngcontroller_xboxone.png.importcontroller_xboxseries.pngcontroller_xboxseries.png.importxbox_button_a.pngxbox_button_a.png.importxbox_button_a_outline.pngxbox_button_a_outline.png.importxbox_button_b.pngxbox_button_b.png.importxbox_button_b_outline.pngxbox_button_b_outline.png.importxbox_button_back.pngxbox_button_back.png.importxbox_button_back_icon.pngxbox_button_back_icon.png.importxbox_button_back_icon_outline.pngxbox_button_back_icon_outline.png.importxbox_button_back_outline.pngxbox_button_back_outline.png.importxbox_button_color_a.pngxbox_button_color_a.png.importxbox_button_color_a_outline.pngxbox_button_color_a_outline.png.importxbox_button_color_b.pngxbox_button_color_b.png.importxbox_button_color_b_outline.pngxbox_button_color_b_outline.png.importxbox_button_color_x.pngxbox_button_color_x.png.importxbox_button_color_x_outline.pngxbox_button_color_x_outline.png.importxbox_button_color_y.pngxbox_button_color_y.png.importxbox_button_color_y_outline.pngxbox_button_color_y_outline.png.importxbox_button_menu.pngxbox_button_menu.png.importxbox_button_menu_outline.pngxbox_button_menu_outline.png.importxbox_button_share.pngxbox_button_share.png.importxbox_button_share_outline.pngxbox_button_share_outline.png.importxbox_button_start.pngxbox_button_start.png.importxbox_button_start_icon.pngxbox_button_start_icon.png.importxbox_button_start_icon_outline.pngxbox_button_start_icon_outline.png.importxbox_button_start_outline.pngxbox_button_start_outline.png.importxbox_button_view.pngxbox_button_view.png.importxbox_button_view_outline.pngxbox_button_view_outline.png.importxbox_button_x.pngxbox_button_x.png.importxbox_button_x_outline.pngxbox_button_x_outline.png.importxbox_button_y.pngxbox_button_y.png.importxbox_button_y_outline.pngxbox_button_y_outline.png.importxbox_dpad.pngxbox_dpad.png.importxbox_dpad_all.pngxbox_dpad_all.png.importxbox_dpad_down.pngxbox_dpad_down.png.importxbox_dpad_down_outline.pngxbox_dpad_down_outline.png.importxbox_dpad_horizontal.pngxbox_dpad_horizontal.png.importxbox_dpad_horizontal_outline.pngxbox_dpad_horizontal_outline.png.importxbox_dpad_left.pngxbox_dpad_left.png.importxbox_dpad_left_outline.pngxbox_dpad_left_outline.png.importxbox_dpad_none.pngxbox_dpad_none.png.importxbox_dpad_right.pngxbox_dpad_right.png.importxbox_dpad_right_outline.pngxbox_dpad_right_outline.png.importxbox_dpad_round.pngxbox_dpad_round.png.importxbox_dpad_round_all.pngxbox_dpad_round_all.png.importxbox_dpad_round_down.pngxbox_dpad_round_down.png.importxbox_dpad_round_horizontal.pngxbox_dpad_round_horizontal.png.importxbox_dpad_round_left.pngxbox_dpad_round_left.png.importxbox_dpad_round_right.pngxbox_dpad_round_right.png.importxbox_dpad_round_up.pngxbox_dpad_round_up.png.importxbox_dpad_round_vertical.pngxbox_dpad_round_vertical.png.importxbox_dpad_up.pngxbox_dpad_up.png.importxbox_dpad_up_outline.pngxbox_dpad_up_outline.png.importxbox_dpad_vertical.pngxbox_dpad_vertical.png.importxbox_dpad_vertical_outline.pngxbox_dpad_vertical_outline.png.importxbox_elite_paddle_bottom_left.pngxbox_elite_paddle_bottom_left.png.importxbox_elite_paddle_bottom_left_outline.pngxbox_elite_paddle_bottom_left_outline.png.importxbox_elite_paddle_bottom_right.pngxbox_elite_paddle_bottom_right.png.importxbox_elite_paddle_bottom_right_outline.pngxbox_elite_paddle_bottom_right_outline.png.importxbox_elite_paddle_top_left.pngxbox_elite_paddle_top_left.png.importxbox_elite_paddle_top_left_outline.pngxbox_elite_paddle_top_left_outline.png.importxbox_elite_paddle_top_right.pngxbox_elite_paddle_top_right.png.importxbox_elite_paddle_top_right_outline.pngxbox_elite_paddle_top_right_outline.png.importxbox_guide.pngxbox_guide.png.importxbox_guide_outline.pngxbox_guide_outline.png.importxbox_lb.pngxbox_lb.png.importxbox_lb_outline.pngxbox_lb_outline.png.importxbox_ls.pngxbox_ls.png.importxbox_ls_outline.pngxbox_ls_outline.png.importxbox_lt.pngxbox_lt.png.importxbox_lt_outline.pngxbox_lt_outline.png.importxbox_rb.pngxbox_rb.png.importxbox_rb_outline.pngxbox_rb_outline.png.importxbox_rs.pngxbox_rs.png.importxbox_rs_outline.pngxbox_rs_outline.png.importxbox_rt.pngxbox_rt.png.importxbox_rt_outline.pngxbox_rt_outline.png.importxbox_stick_l.pngxbox_stick_l.png.importxbox_stick_l_down.pngxbox_stick_l_down.png.importxbox_stick_l_horizontal.pngxbox_stick_l_horizontal.png.importxbox_stick_l_left.pngxbox_stick_l_left.png.importxbox_stick_l_press.pngxbox_stick_l_press.png.importxbox_stick_l_right.pngxbox_stick_l_right.png.importxbox_stick_l_up.pngxbox_stick_l_up.png.importxbox_stick_l_vertical.pngxbox_stick_l_vertical.png.importxbox_stick_r.pngxbox_stick_r.png.importxbox_stick_r_down.pngxbox_stick_r_down.png.importxbox_stick_r_horizontal.pngxbox_stick_r_horizontal.png.importxbox_stick_r_left.pngxbox_stick_r_left.png.importxbox_stick_r_press.pngxbox_stick_r_press.png.importxbox_stick_r_right.pngxbox_stick_r_right.png.importxbox_stick_r_up.pngxbox_stick_r_up.png.importxbox_stick_r_vertical.pngxbox_stick_r_vertical.png.importxbox_stick_side_l.pngxbox_stick_side_l.png.importxbox_stick_side_r.pngxbox_stick_side_r.png.importxbox_stick_top_l.pngxbox_stick_top_l.png.importxbox_stick_top_r.pngxbox_stick_top_r.png.import
PCs
Resources
Scenes
Scripts
Towers
UI
Weapons
Worlds/GreenPlanet/Enemies
XeluController&KeyPrompts
Keyboard & Mouse
Blanks
Dark
0_Key_Dark.png10_Key_Dark.png11_Key_Dark.png12_Key_Dark.png1_Key_Dark.png1_Key_Dark.png.import2_Key_Dark.png2_Key_Dark.png.import3_Key_Dark.png4_Key_Dark.png4_Key_Dark.png.import5_Key_Dark.png5_Key_Dark.png.import6_Key_Dark.png6_Key_Dark.png.import7_Key_Dark.png7_Key_Dark.png.import8_Key_Dark.png8_Key_Dark.png.import9_Key_Dark.png9_Key_Dark.png.importA_Key_Dark.pngAlt_Key_Dark.pngAlt_Key_Dark.png.importArrow_Down_Key_Dark.pngArrow_Down_Key_Dark.png.importArrow_Left_Key_Dark.pngArrow_Left_Key_Dark.png.importArrow_Right_Key_Dark.pngArrow_Up_Key_Dark.pngArrow_Up_Key_Dark.png.importAsterisk_Key_Dark.pngAsterisk_Key_Dark.png.importB_Key_Dark.pngB_Key_Dark.png.importBackspace_Alt_Key_Dark.pngBackspace_Alt_Key_Dark.png.importBackspace_Key_Dark.pngBackspace_Key_Dark.png.importBracket_Left_Key_Dark.pngBracket_Left_Key_Dark.png.importBracket_Right_Key_Dark.pngBracket_Right_Key_Dark.png.importC_Key_Dark.pngC_Key_Dark.png.importCaps_Lock_Key_Dark.pngCaps_Lock_Key_Dark.png.importCommand_Key_Dark.pngCommand_Key_Dark.png.importCtrl_Key_Dark.pngCtrl_Key_Dark.png.importD_Key_Dark.pngD_Key_Dark.png.importDel_Key_Dark.pngE_Key_Dark.pngE_Key_Dark.png.importEnd_Key_Dark.pngEnd_Key_Dark.png.importEnter_Alt_Key_Dark.pngEnter_Alt_Key_Dark.png.importEnter_Key_Dark.pngEnter_Key_Dark.png.importEnter_Tall_Key_Dark.pngEsc_Key_Dark.pngEsc_Key_Dark.png.importF10_Key_Dark.pngF10_Key_Dark.png.importF11_Key_Dark.pngF11_Key_Dark.png.importF12_Key_Dark.pngF12_Key_Dark.png.importF1_Key_Dark.pngF1_Key_Dark.png.importF2_Key_Dark.pngF2_Key_Dark.png.importF3_Key_Dark.pngF3_Key_Dark.png.importF4_Key_Dark.pngF4_Key_Dark.png.importF5_Key_Dark.pngF5_Key_Dark.png.importF6_Key_Dark.pngF6_Key_Dark.png.importF7_Key_Dark.pngF7_Key_Dark.png.importF8_Key_Dark.pngF8_Key_Dark.png.importF9_Key_Dark.pngF9_Key_Dark.png.importF_Key_Dark.pngF_Key_Dark.png.importG_Key_Dark.pngH_Key_Dark.pngHome_Key_Dark.pngHome_Key_Dark.png.importI_Key_Dark.pngI_Key_Dark.png.importInsert_Key_Dark.pngInsert_Key_Dark.png.importJ_Key_Dark.pngJ_Key_Dark.png.importK_Key_Dark.pngK_Key_Dark.png.importL_Key_Dark.pngL_Key_Dark.png.importM_Key_Dark.pngM_Key_Dark.png.importMark_Left_Key_Dark.pngMark_Left_Key_Dark.png.importMark_Right_Key_Dark.pngMark_Right_Key_Dark.png.importMinus_Key_Dark.pngMinus_Key_Dark.png.importMouse_Left_Key_Dark.pngMouse_Left_Key_Dark.png.importMouse_Middle_Key_Dark.pngMouse_Middle_Key_Dark.png.importMouse_Right_Key_Dark.pngMouse_Right_Key_Dark.png.importMouse_Simple_Key_Dark.pngMouse_Simple_Key_Dark.png.importN_Key_Dark.pngN_Key_Dark.png.importNum_Lock_Key_Dark.pngO_Key_Dark.pngP_Key_Dark.pngP_Key_Dark.png.importPage_Down_Key_Dark.pngPage_Up_Key_Dark.pngPage_Up_Key_Dark.png.importPlus_Key_Dark.pngPlus_Key_Dark.png.importPlus_Tall_Key_Dark.pngPlus_Tall_Key_Dark.png.importPrint_Screen_Key_Dark.pngPrint_Screen_Key_Dark.png.importQ_Key_Dark.pngQ_Key_Dark.png.importQuestion_Key_Dark.pngQuestion_Key_Dark.png.importQuote_Key_Dark.pngQuote_Key_Dark.png.importR_Key_Dark.pngR_Key_Dark.png.importS_Key_Dark.pngS_Key_Dark.png.importSemicolon_Key_Dark.pngSemicolon_Key_Dark.png.importShift_Alt_Key_Dark.pngShift_Alt_Key_Dark.png.importShift_Key_Dark.pngShift_Key_Dark.png.importSlash_Key_Dark.pngSlash_Key_Dark.png.importSpace_Key_Dark.pngSpace_Key_Dark.png.importT_Key_Dark.pngT_Key_Dark.png.importTab_Key_Dark.pngTab_Key_Dark.png.importTilda_Key_Dark.pngTilda_Key_Dark.png.importU_Key_Dark.pngU_Key_Dark.png.importV_Key_Dark.pngV_Key_Dark.png.importW_Key_Dark.pngW_Key_Dark.png.importWin_Key_Dark.pngX_Key_Dark.pngX_Key_Dark.png.importY_Key_Dark.pngY_Key_Dark.png.importZ_Key_Dark.pngZ_Key_Dark.png.import
Others
Amazon Luna
Arrows
Controller_Disconnected.png
Gestures
Google Stadia
Ouya
PS Move
PS Vita
PS3
PS4
Positional Prompts
Preview.fla
Steam
VR
Oculus
Vive
Wii
WiiU
Xbox 360
Xbox One
PS5
Readme.txt
Steam Deck
Switch
Xbox Series
energy_bar.gdenergy_bar.tscnexport_presets.cfgproject.godot

@ -3,28 +3,54 @@ class_name EnergyBar extends Control
@export var cell_icon_tex: Texture
@export var bar_overlay: TextureRect
@export var progress_bar: ProgressBar
@export var big_progress_bar: ProgressBar
@export var secondary_progress_bar: ProgressBar
@export var bg: TextureRect
var cell_icons: Array[TextureRect]
var energy: float = 0
var secondary_energy: float = 0 :
get():
return secondary_energy
set(value):
secondary_energy = value
secondary_progress_bar.value = secondary_energy
var prev_energy_int: int = 0
var max_energy: float = 0 :
get():
return max_energy
set(value):
max_energy = value
energy = max_energy
var secondary_max_energy: float = 0:
get():
return secondary_max_energy
set(value):
secondary_max_energy = value
secondary_energy = secondary_max_energy
secondary_progress_bar.visible = true
secondary_progress_bar.max_value = secondary_max_energy
#TODO: we can just create all 12 of these not even in a script, just create them
#and use the bar overlay to hide the unused ones, we just need to change the algorithm
#for setting the used ones invisible to account for the ones that are there but hidden
func create_discrete_icons(new_energy: int) -> void:
progress_bar.visible = false
bg.visible = true
progress_bar.visible = true
big_progress_bar.visible = false
for icon: TextureRect in cell_icons:
icon.queue_free()
if new_energy < 12:
bar_overlay.visible = true
bar_overlay.texture.region = Rect2(159.0 * (-new_energy + 11), 0.0, 159.0, 422.0)
bar_overlay.texture.region = Rect2(117.0 * (-new_energy + 11), 0.0, 117.0, 442.0)
#progress_bar.position = Vector2(-101.0, -430.0 + ((-new_energy + 12.0) * 27.0))
#progress_bar.size = Vector2(60.0, 316.0 - ((-new_energy + 12.0) * 27.0))
else:
bar_overlay.visible = false
#progress_bar.position = Vector2(-101.0, -430.0)
#progress_bar.size = Vector2(60.0, 316.0)
progress_bar.position = Vector2(-101.0, -430.0 + ((-new_energy + 12.0) * 27.0))
progress_bar.size = Vector2(60.0, 316.0 - ((-new_energy + 12.0) * 27.0))
cell_icons = []
energy = new_energy
for x: int in energy:
@ -33,19 +59,25 @@ func create_discrete_icons(new_energy: int) -> void:
#new_icon.expand_mode = TextureRect.EXPAND_FIT_HEIGHT_PROPORTIONAL
#new_icon.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
new_icon.size = Vector2(42.0, 35.0)
new_icon.position = Vector2(-70, -70 + (-27 * x))
new_icon.position = Vector2(-92, -150 + (-27 * x))
cell_icons.append(new_icon)
add_child(new_icon)
progress_bar.max_value = max_energy
progress_bar.value = max_energy
func enable_progress_bar() -> void:
for icon: TextureRect in cell_icons:
icon.queue_free()
cell_icons = []
bar_overlay.visible = false
progress_bar.visible = true
big_progress_bar.visible = true
bar_overlay.visible = false
bg.visible = false
progress_bar.max_value = max_energy
progress_bar.value = max_energy
big_progress_bar.max_value = max_energy
big_progress_bar.value = max_energy
func blank() -> void:
@ -56,6 +88,16 @@ func blank() -> void:
cell_icons = []
func gain_secondary_energy(energy_gained: float, _energy_type: Data.EnergyType = Data.EnergyType.DISCRETE) -> void:
if secondary_energy >= secondary_max_energy:
return
secondary_energy += energy_gained
func disable_secondary_energy() -> void:
secondary_progress_bar.visible = false
func use_energy(energy_used: float, energy_type: Data.EnergyType = Data.EnergyType.DISCRETE) -> void:
if energy <= 0:
return
@ -63,18 +105,19 @@ func use_energy(energy_used: float, energy_type: Data.EnergyType = Data.EnergyTy
for x: int in int(energy_used):
energy -= 1
cell_icons[energy].visible = false
energy = floorf(energy)
else:
energy -= energy_used
progress_bar.value = energy
progress_bar.value = energy
big_progress_bar.value = energy
func gain_energy(energy_gained: float, energy_type: Data.EnergyType = Data.EnergyType.DISCRETE) -> void:
if energy >= max_energy:
return
if energy_type == Data.EnergyType.DISCRETE:
for x: int in int(energy_gained):
cell_icons[energy].visible = true
energy += 1
else:
energy += energy_gained
progress_bar.value = energy
energy += energy_gained
progress_bar.value = energy
big_progress_bar.value = energy
if energy_type == Data.EnergyType.DISCRETE and int(energy) > prev_energy_int:
cell_icons[int(energy) - 1].visible = true
prev_energy_int = int(energy)