miércoles, 27 de diciembre de 2023

Script para manejar un aparato volador, atento a las lineas rojas hacen que se borre del juego por la linea que dice queue_free() al pulsar tecla numero 2;

 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,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

if event.keycode == KEY_1:

rotate_z(1)

pass

if event.keycode == KEY_2:

rotate_x(1)

queue_free()

pass

#var objeto = load ("res://rigid_body_3d_2lochoco.tscn")

## func _ready();

#set_process(true)

#func _process(delta):

##var instanciar = objeto.instance()

#if event.keycode == KEY_4: 

# add_child(instanciar)

##  pass


Script para Godot3d 4.2 que sirve para cambiar la posicion de su contenido cuando algo toca su Area3d;

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

translate(Vector3(0, 100,0))

pass # Replace with function body.



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

En este script estoy intentando recolocar una camara cuando algo toca el Area3d donde esta como hijo,

quizas pueda por algun impacto que la camara enfoque un letrero de game over, u otro letrero de juego completado...........

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


martes, 26 de diciembre de 2023

Script de godot 3d 4.2 entra en area3d se translada sale del area retorna;

 


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

translate(Vector3(16, 0, 0) * 0.5)

pass # Replace with function body.



func _on_area_exited(area):

translate(Vector3(-16, 0, 0) * 0.1)

pass # 


Script para godot3d 4.2 cuando algo entra en el area3d se mueve en el vector y cambia de posicion;

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

translate(Vector3(16, 0, 0))

pass # Replace with function body.


lunes, 25 de diciembre de 2023

script para godot3d 4.2 cuando algo entra en el area3d se encoge el objeto;

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

scale.y-=0.05

pass


SCRIPT EN GODOT3D 4.2 QUE ACTIVA UNA ANIMACION DE UN PERSONAJE CON HUESOS...;

 extends Node3D



# 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("Game_engineAction")

pass

---------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
Este script anima una animacion de un humanoide, primero se hace con makehuman-community un personaje luego de asignarle un esqueleto se pasa a fbx a blender , en blender se anima a mano, y de hay se exporta a godot3d 4.2 en formato glb, en el script se pone el nombre de la animacion....."Game_engineAction" en este caso, pero se puede poner el nombre que queramos....




martes, 19 de diciembre de 2023

Script para godot3d 4.2 que produce una animacion exclusivamente presionando boton del raton;

 extends CSGSphere3D


func _input(event):


#if event is InputEventMouseMotion:

if Input.is_action_just_pressed("MOUSE_RIGHT"):

 

$AnimationPlayer.play("blanca4")



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

El script solo funciona si primero se cliquea arriba del todo en godot en proyeco luego en configuracion del proyecto luego hay que escribir en nueva accion un nombre yo en este caso segui un ejemplo y puse 

MOUSE_RIGHT  cuando aparece devajo del todo se le da a mas y yo en este caso elegi Boton izquierdo del mouse...aunque 
right creo significa derecho....son solo pruebas y me funciona pienso que si pongo en castellano RATON_IZQUIERDO  funcionara de igual forma, entonces en el escript hay que poner tambien RATON_IZQUIERDO .....en fin boy haciendo pruebas y boy abanzando......
-------------------------------------------------------------------------------------------------------------------------