Hey Zylann. So to explain the set up i have, have a scene with character running around, and as soon as character jumps and catches the light, it changes the light (sprite).
So there is a scene that holds the environment (root node). A player (character) is child of this root. And the light (saved separately as xml file) is also child of this scene. Now within the light file itself i added this code to have a little animation and also do area2d.
So as soon as the character touches area2d it should substitue with a different sprite. Was wondering if i should keep the sprite(new texture that should pop up in place of old one) in light.xml or scene.xml?
Preview of code from light.xml :
#for small lights, get 1 point
export var light_value = 1
var texture = preload("res://InsideHouse_lvl01/c2_lightLED.png")
if get_owner() != null:
get_owner().lights_total += light_value
#connect the area2d with node using code, connect function. Say 'self' cos its referring to light node
func _change_lights( body ):
Will be appreciated if you can help. I have managed to make the light disappear, where instead of body.ontouchedbything() i simply put "queuefree()"