--------------------------------------------------------------------------------------------
script en Gd para godot de empezar a moverse por un terreno en godot
----------------------------------------------------------------------------------------------------------
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
---------------------------------------------------------------------------------------------------------------------------
sencillisimo sript para salir del juego mientras se ejecuta al presionar escape......ya veis 5 simples lineas
----------------------------------------------------------------------------------------------------------------------------------------------
extends Node3D
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_ESCAPE:
get_tree().quit()
---------------------------------------------------------------------------------------------------------------------------------
script en Gd tres formas de rotar presionando teclas m-b-h
----------------------------------------------------------------------------------------------------------------------------------
extends MeshInstance3D
#func _ready():
#Input.mouse_mode=Input.MOUSE_MODE_CAPTURED
#func _unhandled_input(event):
#if event is InputEventMouseMotion and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED:
#rotate_x(0.33)
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_M:
rotate_y(0.33)
pass
if event is InputEventKey:
if event.pressed and event.keycode == KEY_H:
rotate_z(0.33)
pass
if event is InputEventKey:
if event.pressed and event.keycode == KEY_B:
rotate_x(0.33)
pass
No hay comentarios:
Publicar un comentario