domingo, 26 de noviembre de 2023

Como hacer un proyectil con Godot y sript GD con caracteristicas particulares y sin instanciar;

 -------------------------------------------------------------------------------------------------------------------------

Este script sirve para girar un proyectil y para lanzarlo y recogerlo.....es un tema del que estoy muy limitado ...

pero que e de seguir estudiando haber si consigo algo util para algun juego de tema disparos colisiones e impactos...

------------------------------------------------------------------------------------------------------------------------


extends CSGSphere3D



func _unhandled_input(event):


if event is InputEventKey:


if event.pressed and event.keycode == KEY_X:


rotate_x(0.33)               

pass




if event is InputEventKey:


if event.pressed and event.keycode == KEY_C:


rotate_x(10.33)               

pass





if event is InputEventKey:

if event.pressed and event.keycode == KEY_B:

translate(Vector3(0,-3.15,0))

pass





if event is InputEventKey:

if event.pressed and event.keycode == KEY_V:

translate(Vector3(0,3.15,0))

pass




------------------------------------------------------------------------------------------------------------------

una nueva  variante del script que tiene sonido al disparar y se puede dirigir la direccion del disparo

------------------------------------------------------------------------------------------------------------------





extends CSGSphere3D



func _unhandled_input(event):


if event is InputEventKey:


if event.pressed and event.keycode == KEY_X:


rotate_x(0.11)               

pass




if event is InputEventKey:


if event.pressed and event.keycode == KEY_C:


rotate_y(0.11)               

pass





if event is InputEventKey:

if event.pressed and event.keycode == KEY_B:

translate(Vector3(0,-0.25,0))

$AudioStreamPlayer.play()

pass





if event is InputEventKey:

if event.pressed and event.keycode == KEY_V:


translate(Vector3(0,0.25,0))

$AudioStreamPlayer.play()

pass



----------------------------------------------------------------------------------------------------

mas mejoras del del mismo script

----------------------------------------------------------------------------------------------------

extends CSGSphere3D



func _unhandled_input(event):


if event is InputEventKey:


if event.pressed and event.keycode == KEY_X:


rotate_x(0.11)               

pass




if event is InputEventKey:


if event.pressed and event.keycode == KEY_N:


rotate_y(0.11)               

pass




if event is InputEventKey:

if event.pressed and event.keycode == KEY_B:

translate(Vector3(0,-0.25,0))

$AudioStreamPlayer.play()

pass





if event is InputEventKey:

if event.pressed and event.keycode == KEY_V:


translate(Vector3(0,0.25,0))

$AudioStreamPlayer.play()

pass


if event is InputEventKey:

if event.pressed and event.keycode == KEY_M:


rotate_y(-0.11)               

pass



if event is InputEventKey:

if event.pressed and event.keycode == KEY_C:


rotate_x(-0.11)               

pass






jueves, 23 de noviembre de 2023

Scripts para Godot en Gd para hacer efecto de volar;






-----------------------------------------------------------------------

para girar la elice

---------------------------------------------------------------------------------

 extends MeshInstance3D


func _unhandled_input(event):

if event is InputEventKey:

if event.pressed and event.keycode == KEY_6:

rotate_y(0.88)

$AudioStreamPlayer3D.play()





if event.pressed and event.keycode == KEY_W:

rotate_y(0.33)

$AudioStreamPlayer3D.play()



if event.pressed and event.keycode == KEY_A: 

rotate_y(0.44)

$AudioStreamPlayer3D.play()

if event.pressed and event.keycode == KEY_D: 

rotate_y(0.41)

$AudioStreamPlayer3D.play()


if event.pressed and event.keycode == KEY_S:

rotate_y(0.48)

$AudioStreamPlayer3D.play()



if event.pressed and event.keycode == KEY_I:

rotate_y(0.33)

$AudioStreamPlayer3D.play()

if event.pressed and event.keycode == KEY_J:

rotate_y(0.33)

$AudioStreamPlayer3D.play()


if event.pressed and event.keycode == KEY_K:

rotate_y(0.33)

$AudioStreamPlayer3D.play()

if event.pressed and event.keycode == KEY_L:

rotate_y(0.33)

$AudioStreamPlayer3D.play()










---------------------------------------------------------------------------------------------------------
para mover y elevar el aparato
-----------------------------------------------------------------------------------------------------








extends RigidBody3D



func _unhandled_input(event):
#if event is InputEventKey:
#if event.pressed and event.keycode == KEY_O:
if event is InputEventKey and event.pressed:
if event.keycode == KEY_J:
#queue_free()
translate(Vector3(1,0,0))
$AudioStreamPlayer.play()
pass

if event is InputEventKey and event.pressed:
if event.keycode == KEY_L:
 
#queue_free()
translate(Vector3(-1,0,0))
$AudioStreamPlayer.play()
pass
 
if event is InputEventKey and event.pressed:
if event.keycode == KEY_I:
#queue_free()
translate(Vector3(0,0,1))
$AudioStreamPlayer.play()
pass


 
if event is InputEventKey and event.pressed:
if event.keycode == KEY_K:
 
#queue_free()
translate(Vector3(0,0,-1))
$AudioStreamPlayer.play()
pass

if event is InputEventKey and event.pressed:
if event.keycode == KEY_Z:
#queue_free()
translate(Vector3(0,1,0))
pass
 
if event is InputEventKey and event.pressed:
if event.keycode == KEY_R:
 
#queue_free()
translate(Vector3(0,2,0))
pass 
if event is InputEventKey and event.pressed:
if event.keycode == KEY_O:
 
#queue_free()
rotate_y(0.04)
pass 
if event is InputEventKey and event.pressed:
if event.keycode == KEY_P:
 
#queue_free()
rotate_y(-0.04)
pass 
if event.keycode == KEY_9:
add_constant_force(Vector3(0,-33,0))
pass
if event.keycode == KEY_8:
add_constant_force(Vector3(0,33,0))
pass
if event.keycode == KEY_7:
apply_torque_impulse(Vector3(0,-10,0))
pass
if event.keycode == KEY_6: 

apply_impulse(Vector3(0,210,0))
pass
if event.keycode == KEY_W: 

apply_impulse(Vector3(0,0,40))
pass
if event.keycode == KEY_S: 
apply_impulse(Vector3(0,0,-40))
pass
if event.keycode == KEY_A: 
apply_impulse(Vector3(40,0,0))
pass
if event.keycode == KEY_D: 
apply_impulse(Vector3(-40,0,0))
pass
if event.keycode == KEY_1:
rotate_z(1)
pass
if event.keycode == KEY_2:
rotate_x(1)
pass




miércoles, 22 de noviembre de 2023

Script en Gd para Godot que mueve un cubo por la escena y ademas le provoca sonido al presionar teclas i-j-k-l;

 extends RigidBody3D




func _unhandled_input(event):

#if event is InputEventKey:

#if event.pressed and event.keycode == KEY_O:

if event is InputEventKey and event.pressed:

if event.keycode == KEY_J:

#queue_free()

translate(Vector3(1,0,0))

$AudioStreamPlayer.play()

pass


if event is InputEventKey and event.pressed:

if event.keycode == KEY_L:

 

#queue_free()

translate(Vector3(-1,0,0))

$AudioStreamPlayer.play()

pass

 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_I:

#queue_free()

translate(Vector3(0,0,1))

$AudioStreamPlayer.play()

pass



 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_K:

 

#queue_free()

translate(Vector3(0,0,-1))

$AudioStreamPlayer.play()

pass


if event is InputEventKey and event.pressed:

if event.keycode == KEY_Z:

#queue_free()

translate(Vector3(0,1,0))

pass

 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_R:

 

#queue_free()

translate(Vector3(0,2,0))

pass 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_O:

 

#queue_free()

rotate_y(0.04)

pass 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_P:

 

#queue_free()

rotate_y(-0.04)

pass 

if event.keycode == KEY_9:

add_constant_force(Vector3(0,-33,0))

pass

if event.keycode == KEY_8:

add_constant_force(Vector3(0,33,0))

pass

if event.keycode == KEY_7:

apply_torque_impulse(Vector3(0,-10,0))

pass

if event.keycode == KEY_6: 


apply_impulse(Vector3(0,210,0))

pass

if event.keycode == KEY_W: 


apply_impulse(Vector3(0,0,40))

pass

if event.keycode == KEY_S: 

apply_impulse(Vector3(0,0,-40))

pass

if event.keycode == KEY_A: 

apply_impulse(Vector3(40,0,0))

pass

if event.keycode == KEY_D: 

apply_impulse(Vector3(-40,0,0))

pass

Script en Gd para Godot de rotar un objeto, con la tecla 6, la -w-a-s-d, ;

 extends MeshInstance3D


func _unhandled_input(event):

if event is InputEventKey:

if event.pressed and event.keycode == KEY_6:

rotate_y(0.88)

$AudioStreamPlayer3D.play()





if event.pressed and event.keycode == KEY_W:

rotate_y(0.33)

$AudioStreamPlayer3D.play()



if event.pressed and event.keycode == KEY_A: 

rotate_y(0.44)

$AudioStreamPlayer3D.play()

if event.pressed and event.keycode == KEY_D: 

rotate_y(0.41)

$AudioStreamPlayer3D.play()


if event.pressed and event.keycode == KEY_S:

rotate_y(0.48)

$AudioStreamPlayer3D.play()

martes, 21 de noviembre de 2023

Como configurar Audacity para grabar sonido del escritorio de nuestro pc;

Una hora para entenderlo y solamente hay que elegir, para reproducir y para grabar de microfono el mismo sistema de altavoces que estemos utilizando.... bueno en el video se ve y se entiende enseguida
 

lunes, 20 de noviembre de 2023

Script para Godot en Gd y captura de pantalla, produce rotacion y tambien sonido al apretar la tecla numero 6 del teclado del pc;

 Script para Godot en Gd y captura de pantalla, produce rotacion y tambien sonido al apretar la tecla numero 6 del teclado del pc;


------------------------------------------------------------------------------------------------------------------------

extends MeshInstance3D


func _unhandled_input(event):

if event is InputEventKey:

if event.pressed and event.keycode == KEY_6:

rotate_y(0.33)

$AudioStreamPlayer3D.play()

-------------------------------------------------------------------------------------------------------------------------





sábado, 18 de noviembre de 2023

Un script en Gd para Godot para mover un cubo por pantalla de diversas formas;

____________________________________________________________________________

Este script da diferentes tipos de impulso al cubo por pantalla

mediante las teclas  i-j-k-l-o-p-w-a-s-d-9-8-7-6

me encanta experimentar¡¡¡¡

_______________________________________________________________________________




 extends RigidBody3D

func _unhandled_input(event):

#if event is InputEventKey:

#if event.pressed and event.keycode == KEY_O:

if event is InputEventKey and event.pressed:

if event.keycode == KEY_J:

#queue_free()

translate(Vector3(1,0,0))

pass


if event is InputEventKey and event.pressed:

if event.keycode == KEY_L:

 

#queue_free()

translate(Vector3(-1,0,0))

pass

 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_I:

#queue_free()

translate(Vector3(0,0,1))

pass



 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_K:

 

#queue_free()

translate(Vector3(0,0,-1))

pass


if event is InputEventKey and event.pressed:

if event.keycode == KEY_Z:

#queue_free()

translate(Vector3(0,1,0))

pass

 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_R:

 

#queue_free()

translate(Vector3(0,2,0))

pass 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_O:

 

#queue_free()

rotate_y(0.04)

pass 

if event is InputEventKey and event.pressed:

if event.keycode == KEY_P:

 

#queue_free()

rotate_y(-0.04)

pass 

if event.keycode == KEY_9:

add_constant_force(Vector3(0,-33,0))

pass

if event.keycode == KEY_8:

add_constant_force(Vector3(0,33,0))

pass

if event.keycode == KEY_7:

apply_torque_impulse(Vector3(0,-10,0))

pass

if event.keycode == KEY_6: 


apply_impulse(Vector3(0,110,0))

pass

if event.keycode == KEY_W: 


apply_impulse(Vector3(0,0,40))

pass

if event.keycode == KEY_S: 

apply_impulse(Vector3(0,0,-40))

pass

if event.keycode == KEY_A: 

apply_impulse(Vector3(40,0,0))

pass

if event.keycode == KEY_D: 

apply_impulse(Vector3(-40,0,0))

pass