Hello, i'm coding a basic game.
My problem is the following: on one hand, long ranged weapon works wells. I have followed this tutorial, and everything i get from here is on point. (link of said tutorial: http://kidscancode.org/blog/2018/04/godot3_tanks_part1/)
On the other, close combat weapon do not produce anything.
What i did:
var b = $ArmeEquipee.balle.instance()
emit_signal('shoot', $ArmeEquipee.balle, positionGlobale, dir)
So, this is the code used when any character attack. The signal is linked to the main scene were the following piece of code generate my bullet!
func _gen_projo(bullet, _position, _direction):
var b = bullet.instance()
To precise what is a weapon in my code: it is just a bunch of variable that will fixe the rate of fire, the scattering, the type of bullet used and if it's a CC weapon or a long range one. The code that "shoot" is written above, in the caracter.
Lastly, i tried to consider a CC weapon, as a long range one, and it works. (cac = true, for CC weapon, false for LR)
var can_shoot = true
$TpsRecharge.wait_time = gun_cooldown
pass # Replace with function body.
Conclusion / question:
Why the same code, with the same parameter, only work when a signal transmit the information between two scenes?