martes, 4 de junio de 2024

GDScript para Godot 4.2, cuando algo entra en el area3d borra esta y nodos hijos;

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()

$".".queue_free()

$RigidBody3DPALODEEMPUJE/CollisionShape3D.queue_free()

$"CollisionShape3D BORRARLO SI NO VA".queue_free()

pass # Replace with function body.

INSTANCIAR Y BORRAR A LA VEZ NODOS SECUNDARIOS CON GDSCRIPT PARA GODOT 4.2;

 extends Area3D

var Esferauno = preload("res://INMUEBLES/VERDUGO UNO/VERDUGO SIN CAVEZA/NUEVO VERDUGO SIN CAVEZA10.tscn")


# 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 CollisionShape3Dcubo = parent.get_node("CollisionShape3D")


var Esferauno = Esferauno.instantiate()


add_child(Esferauno)


get_node("CollisionShape3D").queue_free()

$"BERDUGO CON ANIMACION Y CAPUCHA".queue_free()

$StaticBody3DREFUERZOPUERTA.queue_free()

pass # Replace with function body.

instanciando con godot 4.2 al soltar el boton del mouse;

 extends MeshInstance3D


var Bullet = preload("res://INMUEBLES/ARMAS/espada_2.tscn")

# 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):


$AnimationPlayer.play("ESPADAENALTO")

pass

func _input(event):


if event is InputEventMouseButton:


if event.button_index == 1 and not event.pressed :

#aparece = false

var bullet = Bullet.instantiate()



add_child(bullet)




#queue_free()



#func _input(event):


#if event is InputEventMouseButton:


#if event.button_index == 1 and not event.pressed :

#aparece = true

#queue_free()