martes, 23 de enero de 2024

Script GDScript para Godot3d 4.2 cuando algo entra en Area3d borra diversos elementos y escala uno y cuando sale provoca sonido;

 extends Area3D



# Called when the node enters the scene tree for the first time.

func _ready():

pass # Replace with function body.



# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

pass



func _on_area_entered(area):

var parent = get_parent()

var Area3DBETA = parent.get_node("Area3DBETA")

#Area3DBETA.queue_free()

get_node("CollisionShape3DBETA").queue_free()

get_node("AMETRALLADOR DE BLENDER PINTADOBETA").queue_free()

get_node ("MeshInstance3DBETA")

scale.y+=5.0


scale.x+=5.2


scale.z+=5.2

pass # Replace with function body.



func _on_area_exited(area):

$AudioStreamPlayer.play()

pass # Replace with function body.


Script en GDScript para godot3d 4.2 , cuando algo entra en un Area3d produce un sonido, cuando algo sale del Area3d se borra su contenido;

 extends Area3D



# Called when the node enters the scene tree for the first time.

func _ready():

pass # Replace with function body.



# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

pass



func _on_area_exited(area):

queue_free()

pass # Replace with function body.



func _on_area_entered(area):

$"../../AudioStreamPlayer".play()

pass # Replace with function body.

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
EXPLICACION:
Entra en Area3d
 algo func _on_area_entered(area):

$"../../AudioStreamPlayer".play()

pass # Replace with function body.

emite sonido.........

Sale algo del Area3d 

func _on_area_exited(area):

queue_free()

pass # Replace with function body.

se borra su contenido.

Como se pone un sonido de musica de fondo en Godot 3d 4.2 que este en bucle y suene una y otra vez?;