extends Node3D
var animacion_actual = "MakeHuman default skeleton|NUEVACAMINATA"#ANIMACION CONTINUA Y FIJA DE CAMINAR
func _ready():
#$AnimationPlayer.play("MakeHuman default skeleton|NUEVACAMINATA")#ANIMACION CONTINUA Y FIJA
pass # Replace with function body.
func _physics_process(delta):
# Agacharse
if Input.is_action_just_pressed("ui_accept"):#TECLA ESPACIO AL PRESIONAR GOLPEA
if animacion_actual != "MakeHuman default skeleton|ATCA":
$AnimationPlayer.play("MakeHuman default skeleton|ATCA")
animacion_actual = "MakeHuman default skeleton|ATCA"
if Input.is_action_just_released("ui_accept"):#TECLA ESPACIO AL SOLTAR VUELVE ANIMACION ANDAR
if animacion_actual != "MakeHuman default skeleton|NUEVACAMINATA":
$AnimationPlayer.play("MakeHuman default skeleton|NUEVACAMINATA")
animacion_actual = "MakeHuman default skeleton|NUEVACAMINATA"
if Input.is_action_just_pressed("RETUERCE"):#TECLA ALT AL PRESIONAR DA ZARPAZO
if animacion_actual != "MakeHuman default skeleton|BOFETON":
$AnimationPlayer.play("MakeHuman default skeleton|BOFETON")
animacion_actual = "MakeHuman default skeleton|BOFETON"
if Input.is_action_just_released("RETUERCE"):#TECLA ALT AL SOLTAR VUELVE A CAMINAR NORMAL
if animacion_actual != "MakeHuman default skeleton|NUEVACAMINATA":
$AnimationPlayer.play("MakeHuman default skeleton|NUEVACAMINATA")
animacion_actual = "MakeHuman default skeleton|NUEVACAMINATA"
if Input.is_action_just_pressed("FLECHA"):#TECLA ALT AL PRESIONAR DA ZARPAZO
if animacion_actual != "MakeHuman default skeleton|ANDASOLO":
$AnimationPlayer.play("MakeHuman default skeleton|ANDASOLO")
animacion_actual = "MakeHuman default skeleton|ANDASOLO"
if Input.is_action_just_released("FLECHA"):#TECLA ALT AL PRESIONAR DA ZARPAZO
if animacion_actual != "MakeHuman default skeleton|NUEVACAMINATA":
$AnimationPlayer.play("MakeHuman default skeleton|NUEVACAMINATA")
animacion_actual = "MakeHuman default skeleton|NUEVACAMINATA"
---------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
extends CharacterBody3D
var rotate_speed = 10.1 # Rotation speed
const SPEED = 8.0 # Movement speed
const JUMP_VELOCITY = 3.5 # Jump velocity
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _ready():
# Replace with function body
pass
func _physics_process(delta):
if not is_on_floor():
velocity.y -= gravity * delta # Apply gravity
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY # Jump
var input_dir = Input.get_vector("ui_left", "ui_right","ui_down", "ui_up",) # Get input direction
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED # Move in X direction
velocity.z = direction.z * SPEED # Move in Z direction
else:
velocity.x = move_toward(velocity.x, 0, SPEED) # Stop horizontal movement
velocity.z = move_toward(velocity.z, 0, SPEED) # Stop vertical movement
move_and_slide() # Apply movement and collisions
var movimiento_vector = Vector3.ZERO # Initialize movement vector
if Input.is_action_pressed("A"): # Move forward
rotate_y(0.04) # Rotate on X axis (negative for down)
if Input.is_action_pressed("D"): # Move forward
rotate_y(-0.04) # Rotate on X axis (negative for down)
elif Input.is_action_pressed("B"): # Move backward
rotate_x(-0.01) # Rotate on X axis (positive for up)
elif Input.is_action_pressed("move_left"):
rotate_y(-0.04) # Rotate on Z axis (positive for left)
elif Input.is_action_pressed("move_right"):
rotate_y(0.04) # Rotate on Z axis (negative for right)
#if Input.is_action_just_pressed("ui_accept"):
func _unhandled_input(event):
if event is InputEventKey and event.pressed:
if event.keycode == KEY_W:
translate(Vector3(0, 0, 60) * get_process_delta_time())
#if Input.Input.is_action_pressed()("ANDAALANTECONW"):
#translate(Vector3(0, 0, 30) * get_process_delta_time())
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Explicacion: practicas de GDScript para animar personajes que al abanzar camine que si esta parado no se mueva , y combinarlo con zarpazos y movimientos..........aun esta verde....pero va saliendo lo que busco.
No hay comentarios:
Publicar un comentario