lunes, 12 de febrero de 2024

Script para godot4.2 3d Cuando presiono boton del mouse me instancia particulas, y cuando dejo de presionar las borra o deja de instanciar;

 extends Area3D


var Particulas = preload("res://GRAFICOS/TERRENO MONTAÑAS ETC/SOLOPARTICULASARMA.tscn")

var particulas_instanciadas: Node = null


func _ready():


pass # Replace with function body.


func _input(event):


if event is InputEventMouseButton:


if event.button_index == 1:

# Instanciar partículas al presionar el botón

if event.pressed:

particulas_instanciadas = Particulas.instantiate()

add_child(particulas_instanciadas)

# Eliminar partículas al soltar el botón

else:

if particulas_instanciadas:

particulas_instanciadas.queue_free()

particulas_instanciadas = null

Script para Godot4.2 3d cuando presiono boton del mouse me instancia particulas;

 extends Area3D


var Particulas = preload("res://GRAFICOS/TERRENO MONTAÑAS ETC/SOLOPARTICULASARMA.tscn")


func _ready():


pass # Replace with function body.



func _input(event):


if event is InputEventMouseButton:


if event.button_index == 1:


var particulas = Particulas.instantiate()



add_child(particulas)

Script para Godot 4.2 al presionar boton del mouse mantiene la rotacion si sigue presionado el boton;

 extends MeshInstance3D


# Speed of rotation (radians per second)

var rotation_speed: float = 90.0


# Stores button press state

var mouse_button_pressed: bool = false


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

# Rotate based on mouse button press and delta time

if mouse_button_pressed:

rotate_z(rotation_speed * delta)


# Called when a mouse button is pressed.

func _input(event):

if event is InputEventMouseButton:

# Handle left mouse button press and release events

if event.button_index == 1:

# Update button press state based on event type

mouse_button_pressed = event.pressed


Script para godot4.2 solo cuando presiono boton del mouse hace un giro;

 extends MeshInstance3D


# 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 _input(event):

if event is InputEventMouseButton:

if event.button_index == 1:

rotate_z(90.149)

# Add an "else" block or remove the "if" if not needed

Script para rotacion constante de un MeshInstance3D; es de formato obj; un arma que lleva un Player;

 extends MeshInstance3D



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

rotate_z(0.049)



pass