atualização 1.0/add menu
This commit is contained in:
@@ -86,10 +86,11 @@ func handle_animations():
|
||||
if !is_on_floor() and gravity > 2:
|
||||
animator.play("Fall", 0.3)
|
||||
else:
|
||||
animator.play("Dead", 03)
|
||||
animator.play("Dead", 0.3)
|
||||
await animator.animation_finished
|
||||
get_parent().get_node("Game_over").visible = true
|
||||
get_tree().paused = true
|
||||
get_parent().get_node("Game_over").visible = true
|
||||
|
||||
func apply_gravity(delta):
|
||||
if not is_on_floor():
|
||||
gravity += 25 * delta
|
||||
@@ -124,8 +125,3 @@ func collect_coin():
|
||||
func damage_player(amount: int):
|
||||
health -= amount
|
||||
verfy_life()
|
||||
|
||||
|
||||
func _on_foot_area_entered(area: Area3D) -> void:
|
||||
if area.name == "damagem_box" :
|
||||
area.damage(foot_damage)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
extends CanvasLayer
|
||||
|
||||
var Play = preload("res://prefabs/Telas/Debug/test_debug.tscn")
|
||||
func _on_play_pressed() -> void: #button Play
|
||||
get_tree().change_scene_to_packed(Play)
|
||||
# Replace with function body.
|
||||
|
||||
|
||||
func _on_quit_game_pressed() -> void:#button Quit
|
||||
get_tree().quit()
|
||||
# Replace with function body.
|
||||
@@ -0,0 +1 @@
|
||||
uid://chlo44qqf1jxt
|
||||
@@ -1,5 +1,6 @@
|
||||
extends CanvasLayer
|
||||
|
||||
const Menu = preload ("res://prefabs/Telas/menu_inicial.tscn")
|
||||
|
||||
func _on_retry_button_pressed() -> void: # Retry_button
|
||||
print("retry pressionado")
|
||||
@@ -16,3 +17,13 @@ func _on_continued_button_pressed() -> void:#continued
|
||||
print("continued pressionado")
|
||||
get_tree().paused = false
|
||||
get_parent().get_node("Pause").visible = false
|
||||
|
||||
|
||||
func _on_menu_pressed() -> void:# button menu
|
||||
get_tree().paused = false
|
||||
get_tree().change_scene_to_file("res://prefabs/Telas/menu_inicial.tscn")
|
||||
print("carregou")
|
||||
|
||||
|
||||
|
||||
# Replace with function body.
|
||||
|
||||
+31
-24
@@ -14,36 +14,40 @@ var EXECUTED:= false
|
||||
@onready var animation_tree = $beetle_bot_Skin/AnimationTree
|
||||
@onready var state_machine = animation_tree.get("parameters/playback")
|
||||
@onready var attack_time := $SecondaryActionTimer
|
||||
@export var LIFE:= 5
|
||||
@export var LIFE:= 2
|
||||
|
||||
|
||||
func verfy_life():
|
||||
if LIFE == 0:
|
||||
dead = true
|
||||
$head/Collision_head.set_deferred("disabled", true)
|
||||
state_machine.travel("poweroff")
|
||||
await animation_tree.animation_finished
|
||||
|
||||
func _process(delta: float):
|
||||
|
||||
velocity = Vector3.ZERO
|
||||
|
||||
match state_machine.get_current_node():
|
||||
if not dead:
|
||||
|
||||
"idle":
|
||||
look_at(Vector3(target.global_position.x, global_position.y, target.global_position.z), Vector3.UP)
|
||||
"walk":
|
||||
if global_position.distance_to(target.global_position) < CHASE_RANGE:
|
||||
nav_agent.target_position = target.global_transform.origin
|
||||
var next_nav_point = nav_agent.get_next_path_position()
|
||||
velocity = (next_nav_point - global_transform.origin).normalized() * SPEED * delta
|
||||
velocity = Vector3.ZERO
|
||||
|
||||
match state_machine.get_current_node():
|
||||
|
||||
"idle":
|
||||
look_at(Vector3(target.global_position.x, global_position.y, target.global_position.z), Vector3.UP)
|
||||
"attack":
|
||||
if not EXECUTED:
|
||||
look_at(Vector3(target.global_position.x, global_position.y, target.global_position.z), Vector3.UP)
|
||||
|
||||
"walk":
|
||||
if global_position.distance_to(target.global_position) < CHASE_RANGE:
|
||||
nav_agent.target_position = target.global_transform.origin
|
||||
var next_nav_point = nav_agent.get_next_path_position()
|
||||
velocity = (next_nav_point - global_transform.origin).normalized() * SPEED * delta
|
||||
look_at(Vector3(target.global_position.x, global_position.y, target.global_position.z), Vector3.UP)
|
||||
"attack":
|
||||
if not EXECUTED:
|
||||
look_at(Vector3(target.global_position.x, global_position.y, target.global_position.z), Vector3.UP)
|
||||
|
||||
animation_tree.set("parameters/conditions/walk", chase_player())
|
||||
animation_tree.set("parameters/conditions/idle", not chase_player())
|
||||
animation_tree.set("parameters/conditions/attack", attack_player())
|
||||
|
||||
|
||||
animation_tree.set("parameters/conditions/walk", chase_player())
|
||||
animation_tree.set("parameters/conditions/idle", not chase_player())
|
||||
animation_tree.set("parameters/conditions/attack", attack_player())
|
||||
|
||||
|
||||
move_and_slide()
|
||||
|
||||
@@ -62,10 +66,7 @@ func _on_area_3d_body_entered(body: Node3D) -> void: #head
|
||||
EXECUTED = false
|
||||
# Replace with function body.
|
||||
|
||||
func damage(amount):
|
||||
LIFE -= amount
|
||||
verfy_life()
|
||||
|
||||
|
||||
|
||||
func _on_secondary_action_timer_timeout() -> void:
|
||||
pass
|
||||
@@ -75,3 +76,9 @@ func _on_secondary_action_timer_timeout() -> void:
|
||||
#pass
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_damage_box_body_entered(body: Node3D) -> void:
|
||||
if body.name == "player":
|
||||
LIFE -= 1
|
||||
verfy_life()
|
||||
|
||||
Reference in New Issue
Block a user