atualização 1.0/add menu
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
|
||||
[gd_scene format=3 uid="uid://cr7p1pwsut4lb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://chlo44qqf1jxt" path="res://test/Scripts/menu_inicial.gd" id="1_47gom"]
|
||||
|
||||
[node name="menu_inicial" type="CanvasLayer" unique_id=507596293]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_47gom")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=583267878]
|
||||
offset_right = 1148.0
|
||||
offset_bottom = 658.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=1503422526]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -98.0
|
||||
offset_top = -33.0
|
||||
offset_right = 98.0
|
||||
offset_bottom = 33.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="Play" type="Button" parent="VBoxContainer" unique_id=1729784933]
|
||||
layout_mode = 2
|
||||
text = "Play"
|
||||
|
||||
[node name="Quit_game" type="Button" parent="VBoxContainer" unique_id=2132465000]
|
||||
layout_mode = 2
|
||||
text = "Quit game"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Play" to="." method="_on_play_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Quit_game" to="." method="_on_quit_game_pressed"]
|
||||
@@ -41,6 +41,10 @@ size_flags_vertical = 4
|
||||
layout_mode = 2
|
||||
text = "Continued"
|
||||
|
||||
[node name="Menu" type="Button" parent="VBoxContainer" unique_id=1808262501]
|
||||
layout_mode = 2
|
||||
text = "Menu"
|
||||
|
||||
[node name="Retry_button" type="Button" parent="VBoxContainer" unique_id=5830091]
|
||||
layout_mode = 2
|
||||
text = "Retry"
|
||||
@@ -50,5 +54,6 @@ layout_mode = 2
|
||||
text = "Quit"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Continued_button" to="." method="_on_continued_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Menu" to="." method="_on_menu_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Retry_button" to="." method="_on_retry_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Quit_button" to="." method="_on_quit_button_pressed"]
|
||||
|
||||
@@ -11,6 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="Game dev"
|
||||
run/main_scene="uid://cr7p1pwsut4lb"
|
||||
config/features=PackedStringArray("4.6", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
+26
-19
@@ -14,35 +14,39 @@ 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):
|
||||
if not dead:
|
||||
|
||||
velocity = Vector3.ZERO
|
||||
velocity = Vector3.ZERO
|
||||
|
||||
match state_machine.get_current_node():
|
||||
match state_machine.get_current_node():
|
||||
|
||||
"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
|
||||
look_at(Vector3(target.global_position.x, global_position.y, target.global_position.z), Vector3.UP)
|
||||
"attack":
|
||||
if not EXECUTED:
|
||||
"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
|
||||
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,9 +66,6 @@ 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:
|
||||
@@ -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