SUM of random integers in godot .

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Yasin

I attached a code to the numbers and added a touch screen button which I named as Hex

  func  _on_Hex_pressed(): 
      $Label.text = str(number) 
      var B = int(str(number))
      print(B )

But it shows the selected/pressed number.For example there are numbers like 5,7,8,9,etc.When I first press/select 5 then press 7 ; I should get the sum as 12.When I click other number how can I make that number add to sum I got from the first two numbers (i.e 5+7 = 12).
“The numbers are random not fixed”. Can somebody help me with this ?

But how can i queue_free a no if the sum of two numbers ( 5+7 = 12) and in the random numbers if there is a number 12 .If both are same how to queue_free them ?

Yasin | 2019-07-09 15:33

:bust_in_silhouette: Reply From: Yasin

I figured it out ; I created a autoload script. Now i can add the selected numbers.