add animations
This commit is contained in:
Binary file not shown.
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
const PLAYER_SCENE := preload("res://scenes/Player.scn")
|
const PLAYER_SCENE := preload("res://scenes/Player.tscn")
|
||||||
const ENEMY_SCENE := preload("res://scenes/Enemy.tscn")
|
const ENEMY_SCENE := preload("res://scenes/Enemy.tscn")
|
||||||
const ROCK_SCENE := preload("res://scenes/Rock.tscn")
|
const ROCK_SCENE := preload("res://scenes/Rock.tscn")
|
||||||
const STICK_SCENE := preload("res://scenes/Stick.tscn")
|
const STICK_SCENE := preload("res://scenes/Stick.tscn")
|
||||||
|
|||||||
+9
-7
@@ -26,6 +26,7 @@ var _is_aiming: bool = false
|
|||||||
|
|
||||||
@onready var mesh_node: MeshInstance3D = $player_man
|
@onready var mesh_node: MeshInstance3D = $player_man
|
||||||
@onready var indicator_node: MeshInstance3D = $KickIndicator
|
@onready var indicator_node: MeshInstance3D = $KickIndicator
|
||||||
|
@onready var anim_player: AnimationPlayer = $AnimationPlayer2
|
||||||
|
|
||||||
var player_mat: StandardMaterial3D
|
var player_mat: StandardMaterial3D
|
||||||
var indicator_mat: StandardMaterial3D
|
var indicator_mat: StandardMaterial3D
|
||||||
@@ -136,6 +137,7 @@ func _handle_iframes(delta: float) -> void:
|
|||||||
|
|
||||||
func _do_kick() -> void:
|
func _do_kick() -> void:
|
||||||
kick_timer = kick_cooldown
|
kick_timer = kick_cooldown
|
||||||
|
_play_kick_blend()
|
||||||
var forward := -global_transform.basis.z
|
var forward := -global_transform.basis.z
|
||||||
forward.y = 0.0
|
forward.y = 0.0
|
||||||
forward = forward.normalized() if forward.length() > 0.01 else Vector3(0.0, 0.0, -1.0)
|
forward = forward.normalized() if forward.length() > 0.01 else Vector3(0.0, 0.0, -1.0)
|
||||||
@@ -201,6 +203,11 @@ func set_aim_direction(yaw_rad: float) -> void:
|
|||||||
_aim_yaw = yaw_rad
|
_aim_yaw = yaw_rad
|
||||||
_is_aiming = true
|
_is_aiming = true
|
||||||
|
|
||||||
|
func _play_kick_blend() -> void:
|
||||||
|
var tw := create_tween()
|
||||||
|
tw.tween_method(func(v: float): mesh_node.set_blend_shape_value(0, v), 0.0, 1.0, 0.12)
|
||||||
|
tw.tween_method(func(v: float): mesh_node.set_blend_shape_value(0, v), 1.0, 0.0, 0.38)
|
||||||
|
|
||||||
func _squish_effect() -> void:
|
func _squish_effect() -> void:
|
||||||
var tw := create_tween()
|
var tw := create_tween()
|
||||||
tw.tween_property(mesh_node, "scale", Vector3(1.3, 0.55, 1.3), 0.07)
|
tw.tween_property(mesh_node, "scale", Vector3(1.3, 0.55, 1.3), 0.07)
|
||||||
@@ -212,18 +219,13 @@ func receive_kick(direction: Vector3, force: float) -> void:
|
|||||||
velocity.x = direction.x * force
|
velocity.x = direction.x * force
|
||||||
velocity.z = direction.z * force
|
velocity.z = direction.z * force
|
||||||
invincible_timer = IFRAMES_DURATION * 0.5
|
invincible_timer = IFRAMES_DURATION * 0.5
|
||||||
|
_squish_effect()
|
||||||
|
|
||||||
func take_damage(amount: int) -> void:
|
func take_damage(amount: int) -> void:
|
||||||
if not is_alive or invincible_timer > 0.0:
|
if not is_alive or invincible_timer > 0.0:
|
||||||
return
|
return
|
||||||
invincible_timer = IFRAMES_DURATION
|
invincible_timer = IFRAMES_DURATION
|
||||||
#health = max(0, health - amount)
|
_squish_effect()
|
||||||
#emit_signal("health_changed", health, max_health)
|
|
||||||
#var tw := create_tween()
|
|
||||||
#tw.tween_property(player_mat, "albedo_color", Color.RED, 0.08)
|
|
||||||
#tw.tween_property(player_mat, "albedo_color", BASE_COLOR, 0.25)
|
|
||||||
#if health <= 0:
|
|
||||||
#_die()
|
|
||||||
|
|
||||||
func heal(amount: int) -> void:
|
func heal(amount: int) -> void:
|
||||||
if not is_alive:
|
if not is_alive:
|
||||||
|
|||||||
Reference in New Issue
Block a user