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






No hay comentarios:

Publicar un comentario