2026-05-08 14:22:54 +00:00
|
|
|
extends CharacterBody3D
|
|
|
|
|
|
2026-05-09 17:18:11 +00:00
|
|
|
const SPEED = 3.5
|
2026-05-11 13:39:16 +00:00
|
|
|
const JUMP_VELOCITY = 3.5
|
2026-05-08 14:22:54 +00:00
|
|
|
|
|
|
|
|
var walk_animation_time = 0
|
2026-05-14 15:57:50 +00:00
|
|
|
var face_rotation = 0
|
2026-05-08 16:33:09 +00:00
|
|
|
var face_left = false
|
2026-05-08 14:22:54 +00:00
|
|
|
|
2026-05-09 15:38:52 +00:00
|
|
|
var combatable = true
|
|
|
|
|
|
2026-05-09 17:18:11 +00:00
|
|
|
var iframes = 0
|
2026-05-09 18:16:23 +00:00
|
|
|
var knockback_time = 0
|
2026-05-09 17:18:11 +00:00
|
|
|
var health = 100
|
|
|
|
|
|
2026-05-17 21:41:28 +00:00
|
|
|
var slots = [
|
|
|
|
|
{
|
|
|
|
|
"id": "basic_sword",
|
2026-05-18 14:41:07 +00:00
|
|
|
"cooldown": 0,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": "basic_handcannon",
|
|
|
|
|
"cooldown": 0,
|
|
|
|
|
},
|
2026-05-17 21:41:28 +00:00
|
|
|
]
|
|
|
|
|
|
2026-05-11 15:11:41 +00:00
|
|
|
var combo_hits = 0
|
|
|
|
|
var combo_timer = 0
|
|
|
|
|
var swing_timer = 0
|
|
|
|
|
|
|
|
|
|
var queue_swing = false
|
|
|
|
|
|
2026-05-16 19:25:43 +00:00
|
|
|
var dodging = false
|
|
|
|
|
var dodge_timer = 0.0
|
|
|
|
|
var dodge_direction = null
|
|
|
|
|
|
2026-05-18 14:41:07 +00:00
|
|
|
var current_slot = 0
|
2026-05-16 01:51:44 +00:00
|
|
|
var current_weapon = "basic_sword"
|
2026-05-11 15:11:41 +00:00
|
|
|
|
2026-05-16 19:25:43 +00:00
|
|
|
enum {
|
|
|
|
|
STATE_NORMAL,
|
|
|
|
|
STATE_DODGING,
|
|
|
|
|
STATE_ATTACK,
|
|
|
|
|
STATE_HIT,
|
2026-05-23 02:27:08 +00:00
|
|
|
STATE_DEATH,
|
|
|
|
|
STATE_MOVE_TO_POINT
|
2026-05-16 19:25:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var state = STATE_NORMAL
|
2026-05-23 02:27:08 +00:00
|
|
|
var point_to_move_to = null
|
|
|
|
|
|
|
|
|
|
var last_basis
|
|
|
|
|
var direction_comfort_timer = 0
|
2026-05-16 19:25:43 +00:00
|
|
|
|
2026-05-08 14:22:54 +00:00
|
|
|
@onready var game = get_parent()
|
2026-05-08 16:33:09 +00:00
|
|
|
@onready var camera = game.get_node("PlayerCamera")
|
2026-05-08 14:22:54 +00:00
|
|
|
|
2026-05-09 17:18:11 +00:00
|
|
|
func hit_me():
|
|
|
|
|
iframes = 0.5
|
|
|
|
|
health -= 10
|
2026-05-09 18:16:23 +00:00
|
|
|
|
2026-05-11 15:11:41 +00:00
|
|
|
func get_my_weapon_info(value: String):
|
2026-05-18 14:41:07 +00:00
|
|
|
return get_weapon_info(current_weapon.id, value)
|
2026-05-11 15:11:41 +00:00
|
|
|
|
|
|
|
|
func get_weapon_info(weapon: String, value: String):
|
|
|
|
|
if value in Global.weapons[weapon]:
|
|
|
|
|
return Global.weapons[weapon][value]
|
|
|
|
|
else: return null
|
|
|
|
|
|
2026-05-09 18:16:23 +00:00
|
|
|
func on_hit(hitter: Node3D = null) -> void:
|
|
|
|
|
iframes = 0.8
|
|
|
|
|
|
|
|
|
|
if hitter:
|
|
|
|
|
knockback_time = 0.25
|
|
|
|
|
velocity += hitter.global_position.direction_to(global_position) * 8
|
|
|
|
|
velocity.y = 0
|
2026-05-18 14:41:07 +00:00
|
|
|
|
|
|
|
|
func give_weapon(weapon_name: String = "basic_sword") -> void:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
func set_weapon_from_slot(slot: int) -> void:
|
|
|
|
|
current_slot = slot
|
|
|
|
|
set_weapon(slots[slot])
|
2026-05-16 17:25:59 +00:00
|
|
|
|
2026-05-18 14:41:07 +00:00
|
|
|
func set_weapon(weapon_data: Dictionary) -> void:
|
|
|
|
|
current_weapon = weapon_data
|
|
|
|
|
$DreamerBody.set_inhand(weapon_data.id)
|
2026-05-16 17:25:59 +00:00
|
|
|
|
2026-05-18 14:41:07 +00:00
|
|
|
var range = get_weapon_info(weapon_data.id, "range")
|
2026-05-16 21:22:56 +00:00
|
|
|
if not range: range = 1
|
2026-05-18 14:41:07 +00:00
|
|
|
var width = get_weapon_info(weapon_data.id, "width")
|
2026-05-16 21:22:56 +00:00
|
|
|
if not width: width = 1
|
2026-05-16 17:25:59 +00:00
|
|
|
|
|
|
|
|
$HitCollision/Shape.shape.size = Vector3(range, 1.0, width)
|
|
|
|
|
|
|
|
|
|
$HitCollision/Shape.position.x = range * -0.5
|
2026-05-17 21:41:28 +00:00
|
|
|
|
|
|
|
|
func dps(weapon_name: String = "basic_sword") -> void:
|
|
|
|
|
var damage = get_weapon_info(weapon_name, "damage")
|
|
|
|
|
var time = get_weapon_info(weapon_name, "swing_time")
|
|
|
|
|
|
|
|
|
|
if get_weapon_info(weapon_name, "combo_weapon"):
|
|
|
|
|
var combo_damage = get_weapon_info(weapon_name, "damage_mid_combo") * get_weapon_info(weapon_name, "hits_to_finish")
|
|
|
|
|
time *= float(get_weapon_info(weapon_name, "hits_to_finish"))
|
|
|
|
|
time += float(get_weapon_info(weapon_name, "swing_time_combo_finish"))
|
|
|
|
|
|
|
|
|
|
LimboConsole.print_line(str(damage / time))
|
2026-05-09 17:18:11 +00:00
|
|
|
|
2026-05-08 14:22:54 +00:00
|
|
|
func _ready() -> void:
|
2026-05-09 17:18:11 +00:00
|
|
|
LimboConsole.register_command(hit_me)
|
2026-05-16 17:25:59 +00:00
|
|
|
LimboConsole.register_command(set_weapon)
|
2026-05-17 21:41:28 +00:00
|
|
|
LimboConsole.register_command(dps)
|
2026-05-18 14:41:07 +00:00
|
|
|
set_weapon_from_slot(0)
|
2026-05-09 17:18:11 +00:00
|
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
2026-05-14 15:57:50 +00:00
|
|
|
|
2026-05-09 17:18:11 +00:00
|
|
|
if iframes > 0:
|
|
|
|
|
iframes -= delta
|
|
|
|
|
$DreamerBody/Body.modulate.a = 0.5
|
|
|
|
|
else:
|
|
|
|
|
$DreamerBody/Body.modulate.a = 1
|
2026-05-09 18:16:23 +00:00
|
|
|
|
|
|
|
|
if knockback_time > 0:
|
|
|
|
|
knockback_time -= delta
|
2026-05-15 16:21:50 +00:00
|
|
|
$DreamerBody/Animator.set("parameters/hit/blend_amount", 1.0)
|
|
|
|
|
else:
|
|
|
|
|
$DreamerBody/Animator.set("parameters/hit/blend_amount", 0.0)
|
2026-05-18 14:41:07 +00:00
|
|
|
|
|
|
|
|
var i = 0
|
|
|
|
|
while i < slots.size():
|
|
|
|
|
if ("cooldown" in slots[i]) and (slots[i].cooldown > 0): slots[i].cooldown -= delta
|
|
|
|
|
|
|
|
|
|
if Input.is_action_just_pressed("hotbar_item_" + str(i + 1)):
|
|
|
|
|
set_weapon_from_slot(i)
|
|
|
|
|
|
|
|
|
|
i += 1
|
2026-05-08 14:22:54 +00:00
|
|
|
|
2026-05-14 15:57:50 +00:00
|
|
|
$DreamerBody.look_at(game.get_node("PlayerCamera").global_position)
|
|
|
|
|
$DreamerBody.rotation.x = 0
|
|
|
|
|
face_rotation = $DreamerBody.rotation.y
|
|
|
|
|
if not face_rotation: face_rotation = 0
|
|
|
|
|
|
2026-05-08 14:22:54 +00:00
|
|
|
if not is_on_floor():
|
|
|
|
|
velocity += get_gravity() * delta
|
2026-05-08 16:33:09 +00:00
|
|
|
|
2026-05-09 15:38:52 +00:00
|
|
|
var viewport_half = (get_viewport().get_visible_rect().size / 2.0)
|
|
|
|
|
var player_position = camera.unproject_position(global_transform.origin)
|
|
|
|
|
|
2026-05-08 16:33:09 +00:00
|
|
|
if face_left:
|
|
|
|
|
$DreamerBody.rotation.y = face_rotation + deg_to_rad(180)
|
2026-05-14 14:04:56 +00:00
|
|
|
$DreamerBody/Animator.set("parameters/layering/blend_amount", 1.0)
|
2026-05-08 16:33:09 +00:00
|
|
|
else:
|
|
|
|
|
$DreamerBody.rotation.y = face_rotation
|
2026-05-14 14:04:56 +00:00
|
|
|
$DreamerBody/Animator.set("parameters/layering/blend_amount", 0.0)
|
2026-05-17 13:42:14 +00:00
|
|
|
|
|
|
|
|
var input_dir := Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
2026-05-23 02:27:08 +00:00
|
|
|
|
|
|
|
|
var direction = (camera.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
|
|
|
|
|
|
|
|
|
if !last_basis:
|
|
|
|
|
last_basis = camera.transform.basis
|
|
|
|
|
|
|
|
|
|
if camera.transform.basis != last_basis:
|
|
|
|
|
direction_comfort_timer += delta
|
|
|
|
|
|
|
|
|
|
direction = (last_basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
|
|
|
|
|
|
|
|
|
if direction_comfort_timer > 0.4:
|
|
|
|
|
last_basis = camera.transform.basis
|
|
|
|
|
else: direction_comfort_timer = 0
|
|
|
|
|
|
2026-05-17 13:42:14 +00:00
|
|
|
if not combatable:
|
|
|
|
|
if input_dir.x > 0:
|
|
|
|
|
face_left = false
|
|
|
|
|
if input_dir.x < 0:
|
|
|
|
|
face_left = true
|
|
|
|
|
|
2026-05-23 02:27:08 +00:00
|
|
|
|
2026-05-17 13:42:14 +00:00
|
|
|
|
|
|
|
|
var mouse_point_angle
|
|
|
|
|
if input_icon.using_gamepad:
|
|
|
|
|
var direction_no_y = direction
|
|
|
|
|
direction_no_y.y = 0
|
|
|
|
|
|
|
|
|
|
var old_rotation = $HitCollision.rotation
|
|
|
|
|
|
|
|
|
|
$HitCollision.look_at(global_position + direction_no_y)
|
|
|
|
|
mouse_point_angle = -$HitCollision.rotation.y - deg_to_rad(45)
|
2026-05-11 15:11:41 +00:00
|
|
|
|
2026-05-17 13:42:14 +00:00
|
|
|
$HitCollision.rotation = old_rotation
|
|
|
|
|
else:
|
|
|
|
|
mouse_point_angle = player_position.angle_to_point(get_viewport().get_mouse_position())
|
2026-05-09 15:38:52 +00:00
|
|
|
|
|
|
|
|
if combatable:
|
2026-05-16 17:25:59 +00:00
|
|
|
if ((swing_timer <= 0) or (combo_hits < 0)):
|
|
|
|
|
$HitCollision.rotation.y = -mouse_point_angle + face_rotation
|
2026-05-11 13:39:16 +00:00
|
|
|
|
2026-05-16 17:25:59 +00:00
|
|
|
if abs(rad_to_deg(mouse_point_angle) - (-90)) < 50:
|
|
|
|
|
$HitCollision/Shape.shape.size.x = 1.5
|
|
|
|
|
else:
|
|
|
|
|
$HitCollision/Shape.shape.size.x = 1.2
|
2026-05-09 15:38:52 +00:00
|
|
|
|
2026-05-16 17:25:59 +00:00
|
|
|
if (rad_to_deg(mouse_point_angle) < -90) or (rad_to_deg(mouse_point_angle) > 90):
|
|
|
|
|
face_left = true
|
|
|
|
|
|
|
|
|
|
var mouse_pos = get_viewport().get_mouse_position()
|
|
|
|
|
mouse_pos.y = (viewport_half.y) + ((viewport_half.y) - mouse_pos.y)
|
|
|
|
|
|
|
|
|
|
#$DreamerBody/Body/ArmPivot.rotation.z = viewport_half.angle_to_point(mouse_pos)
|
|
|
|
|
else:
|
|
|
|
|
face_left = false
|
|
|
|
|
$DreamerBody/Body/ArmPivot.scale.y = 1
|
|
|
|
|
$DreamerBody/Body/ArmPivot.scale.x = 1
|
2026-05-14 14:04:56 +00:00
|
|
|
|
|
|
|
|
$DreamerBody/Animator.set("parameters/hold_weapon/blend_amount", 1.0)
|
2026-05-09 15:38:52 +00:00
|
|
|
else:
|
|
|
|
|
$DreamerBody/Body/ArmPivot.global_rotation.y = face_rotation
|
|
|
|
|
$DreamerBody/Body/ArmPivot.scale.y = 1
|
|
|
|
|
$DreamerBody/Body/ArmPivot.scale.x = 1
|
|
|
|
|
$DreamerBody/Body/ArmPivot.rotation.z = 0
|
2026-05-14 14:04:56 +00:00
|
|
|
|
|
|
|
|
$DreamerBody/Animator.set("parameters/hold_weapon/blend_amount", 0.0)
|
2026-05-08 16:33:09 +00:00
|
|
|
|
2026-05-08 14:22:54 +00:00
|
|
|
if Input.is_action_pressed("jump") and is_on_floor():
|
|
|
|
|
velocity.y = JUMP_VELOCITY
|
|
|
|
|
$DreamerBody/Animator.set("parameters/jump/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
|
2026-05-11 15:11:41 +00:00
|
|
|
|
|
|
|
|
if swing_timer > 0: swing_timer -= delta
|
|
|
|
|
if combo_timer > 0:
|
|
|
|
|
combo_timer -= delta
|
|
|
|
|
if combo_timer <= 0:
|
|
|
|
|
combo_hits = 0
|
2026-05-16 19:25:43 +00:00
|
|
|
|
|
|
|
|
if Input.is_action_just_pressed("dodge") and (not dodging) and (input_dir.length() > 0):
|
|
|
|
|
queue_swing = false
|
|
|
|
|
dodging = true
|
|
|
|
|
dodge_timer = 0.5
|
|
|
|
|
dodge_direction = camera.transform.basis * Vector3(input_dir.x, 0, input_dir.y).normalized()
|
2026-05-09 15:38:52 +00:00
|
|
|
|
2026-05-16 19:25:43 +00:00
|
|
|
$DreamerBody/Animator.set("parameters/dodge/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
|
|
|
|
|
|
2026-05-18 14:41:07 +00:00
|
|
|
if (Input.is_action_just_pressed("attack") or queue_swing) and (not dodging) and (current_weapon.cooldown <= 0):
|
2026-05-11 15:11:41 +00:00
|
|
|
if swing_timer > 0:
|
|
|
|
|
if swing_timer < 0.1:
|
|
|
|
|
queue_swing = true
|
|
|
|
|
else:
|
|
|
|
|
queue_swing = false
|
|
|
|
|
|
|
|
|
|
swing_timer = get_my_weapon_info("swing_time")
|
|
|
|
|
combo_timer = get_my_weapon_info("combo_timeout")
|
|
|
|
|
if swing_timer == null: swing_timer = 0.0
|
|
|
|
|
if combo_timer == null: combo_timer = 0.0
|
|
|
|
|
|
2026-05-16 17:25:59 +00:00
|
|
|
var swooshy_id = get_my_weapon_info("attack_swooshy")
|
|
|
|
|
if not swooshy_id: swooshy_id = "slash"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var attack_swooshy = Global.effects.attack_swooshy[swooshy_id].instantiate()
|
|
|
|
|
game.add_child(attack_swooshy)
|
2026-05-11 15:11:41 +00:00
|
|
|
|
2026-05-16 17:25:59 +00:00
|
|
|
var attack_swooshy_scale = get_my_weapon_info("attack_swooshy_scale")
|
|
|
|
|
if attack_swooshy_scale: attack_swooshy.scale = attack_swooshy_scale
|
|
|
|
|
|
|
|
|
|
attack_swooshy.global_position = global_position
|
|
|
|
|
attack_swooshy.global_rotation.y = $HitCollision.global_rotation.y + deg_to_rad(180)
|
|
|
|
|
attack_swooshy.play_effect()
|
2026-05-11 15:11:41 +00:00
|
|
|
|
2026-05-14 14:04:56 +00:00
|
|
|
$DreamerBody/Animator.set("parameters/swing_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
|
|
|
|
|
|
2026-05-11 15:11:41 +00:00
|
|
|
var hits = $HitCollision.get_overlapping_bodies()
|
2026-05-09 17:18:11 +00:00
|
|
|
|
2026-05-11 15:11:41 +00:00
|
|
|
var knockback = 0
|
|
|
|
|
var damage = 0
|
|
|
|
|
|
2026-05-16 17:25:59 +00:00
|
|
|
velocity = global_position.direction_to($HitCollision/Shape.global_position) * 4
|
|
|
|
|
velocity.y = 0
|
|
|
|
|
|
2026-05-11 15:11:41 +00:00
|
|
|
if get_my_weapon_info("combo_weapon"):
|
2026-05-16 17:25:59 +00:00
|
|
|
var earned_combo_hit = false
|
|
|
|
|
|
|
|
|
|
for body in hits:
|
|
|
|
|
if body == self: continue
|
|
|
|
|
|
|
|
|
|
if ("health" in body) and (body.health > 0):
|
|
|
|
|
earned_combo_hit = true
|
|
|
|
|
|
|
|
|
|
if earned_combo_hit: combo_hits += 1
|
|
|
|
|
else: combo_hits = 0
|
|
|
|
|
|
2026-05-11 15:11:41 +00:00
|
|
|
if combo_hits < get_my_weapon_info("hits_to_finish"):
|
|
|
|
|
damage = get_my_weapon_info("damage_mid_combo")
|
|
|
|
|
knockback = get_my_weapon_info("knockback_mid_combo")
|
|
|
|
|
else:
|
|
|
|
|
damage = get_my_weapon_info("damage")
|
|
|
|
|
knockback = get_my_weapon_info("knockback")
|
|
|
|
|
|
|
|
|
|
combo_hits = 0
|
|
|
|
|
|
|
|
|
|
swing_timer = get_my_weapon_info("swing_time_combo_finish")
|
|
|
|
|
if swing_timer == null: swing_timer = 0.0
|
|
|
|
|
else:
|
|
|
|
|
damage = get_my_weapon_info("damage")
|
|
|
|
|
knockback = get_my_weapon_info("knockback")
|
2026-05-09 17:18:11 +00:00
|
|
|
|
2026-05-11 15:11:41 +00:00
|
|
|
combo_hits = 0
|
|
|
|
|
|
2026-05-16 21:22:56 +00:00
|
|
|
if get_my_weapon_info("ranged_weapon"):
|
2026-05-17 21:41:28 +00:00
|
|
|
var projectile = get_my_weapon_info("projectile").instantiate()
|
|
|
|
|
|
|
|
|
|
game.add_child(projectile)
|
|
|
|
|
projectile.global_position = global_position
|
|
|
|
|
projectile.rotation = $HitCollision.rotation
|
|
|
|
|
|
|
|
|
|
projectile.pow()
|
2026-05-16 21:22:56 +00:00
|
|
|
else:
|
|
|
|
|
for body in hits:
|
|
|
|
|
if body == self: continue
|
2026-05-09 17:18:11 +00:00
|
|
|
|
2026-05-16 21:22:56 +00:00
|
|
|
if ("health" in body) and (body.health > 0):
|
|
|
|
|
body.health -= damage
|
2026-05-11 15:11:41 +00:00
|
|
|
|
2026-05-16 21:22:56 +00:00
|
|
|
var knockback_pos = global_position
|
|
|
|
|
knockback_pos.y = 0
|
|
|
|
|
var knockback_body_pos = $HitCollision/Shape.global_position
|
|
|
|
|
knockback_body_pos.y = 0
|
2026-05-11 15:11:41 +00:00
|
|
|
|
2026-05-16 21:22:56 +00:00
|
|
|
body.position.y += 0.2
|
|
|
|
|
body.velocity.y = 0.4
|
|
|
|
|
body.velocity += knockback_pos.direction_to(knockback_body_pos) * knockback
|
2026-05-12 18:58:31 +00:00
|
|
|
|
2026-05-16 21:22:56 +00:00
|
|
|
if body.velocity.length() > knockback:
|
|
|
|
|
body.velocity = body.velocity.normalized() * knockback
|
|
|
|
|
|
|
|
|
|
if "mid_knockback" in body:
|
|
|
|
|
body.mid_knockback = true
|
|
|
|
|
|
|
|
|
|
if "on_knockback" in body:
|
|
|
|
|
body.on_knockback()
|
|
|
|
|
|
|
|
|
|
var damage_text = preload("res://scenes/effects/damage_text.tscn").instantiate()
|
|
|
|
|
game.add_child(damage_text)
|
|
|
|
|
damage_text.global_position = body.global_position
|
|
|
|
|
damage_text.get_node("Label").text = str(floor(damage))
|
2026-05-17 13:42:14 +00:00
|
|
|
|
2026-05-18 14:41:07 +00:00
|
|
|
if get_my_weapon_info("recharge_time"):
|
|
|
|
|
current_weapon.cooldown = get_my_weapon_info("recharge_time")
|
2026-05-16 19:25:43 +00:00
|
|
|
if dodging and (knockback_time <= 0):
|
|
|
|
|
velocity.x = dodge_direction.x * 6
|
|
|
|
|
velocity.z = dodge_direction.z * 6
|
|
|
|
|
|
|
|
|
|
$DreamerBody/Animator.set("parameters/walk/blend_amount", 0)
|
|
|
|
|
|
|
|
|
|
dodge_timer -= delta
|
|
|
|
|
if dodge_timer <= 0: dodging = false
|
|
|
|
|
|
|
|
|
|
elif direction and (knockback_time <= 0) and (swing_timer <= 0):
|
2026-05-08 14:22:54 +00:00
|
|
|
velocity.x = direction.x * SPEED
|
|
|
|
|
velocity.z = direction.z * SPEED
|
|
|
|
|
|
|
|
|
|
$DreamerBody/Animator.set("parameters/walk/blend_amount", abs(direction.length()))
|
|
|
|
|
else:
|
|
|
|
|
|
2026-05-09 18:16:23 +00:00
|
|
|
velocity.x = move_toward(velocity.x, 0, delta * 24)
|
|
|
|
|
velocity.z = move_toward(velocity.z, 0, delta * 24)
|
2026-05-08 14:22:54 +00:00
|
|
|
|
|
|
|
|
$DreamerBody/Animator.set("parameters/walk/blend_amount", 0)
|
|
|
|
|
|
|
|
|
|
if direction and is_on_floor():
|
|
|
|
|
walk_animation_time += delta * 25
|
|
|
|
|
|
2026-05-08 16:33:09 +00:00
|
|
|
$DreamerBody.position.y = sin(walk_animation_time + 1) / 16
|
2026-05-08 14:22:54 +00:00
|
|
|
$DreamerBody.rotation.z = sin(walk_animation_time / 2) / 16
|
|
|
|
|
else:
|
|
|
|
|
walk_animation_time = 0
|
|
|
|
|
|
|
|
|
|
$DreamerBody.rotation.z /= 1 + (delta * 2.5)
|
|
|
|
|
|
|
|
|
|
$DreamerBody.position.y /= 1 + (delta * 12)
|
|
|
|
|
|
|
|
|
|
if is_on_floor():
|
|
|
|
|
$DreamerBody/Animator.set("parameters/fall/blend_amount", 0)
|
2026-05-08 16:33:09 +00:00
|
|
|
$DreamerBody/Animator.set("parameters/leap/blend_amount", 0)
|
2026-05-08 14:22:54 +00:00
|
|
|
else:
|
2026-05-08 16:33:09 +00:00
|
|
|
if velocity.y < 0:
|
|
|
|
|
$DreamerBody/Animator.set("parameters/fall/blend_amount", 1)
|
|
|
|
|
$DreamerBody/Animator.set("parameters/leap/blend_amount", 0)
|
|
|
|
|
else:
|
|
|
|
|
$DreamerBody/Animator.set("parameters/fall/blend_amount", 0)
|
|
|
|
|
$DreamerBody/Animator.set("parameters/leap/blend_amount", 1)
|
2026-05-08 14:22:54 +00:00
|
|
|
|
|
|
|
|
move_and_slide()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$Shadow.global_position.y = $Floorcast.get_collision_point().y + 0.01
|
|
|
|
|
|
2026-05-16 18:05:49 +00:00
|
|
|
$Label3D.text = str(velocity.length())
|
|
|
|
|
|