menu + player
This commit is contained in:
@@ -11,6 +11,7 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Mal-Adresse"
|
config/name="Mal-Adresse"
|
||||||
|
run/main_scene="res://scene/city.tscn"
|
||||||
config/features=PackedStringArray("4.3", "C#", "Forward Plus")
|
config/features=PackedStringArray("4.3", "C#", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,27 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://co0u7xd45nxv1"]
|
[gd_scene load_steps=4 format=3 uid="uid://co0u7xd45nxv1"]
|
||||||
|
|
||||||
[ext_resource type="FontFile" uid="uid://c0i81edd5mitx" path="res://font/October Crow.ttf" id="1_ndt1a"]
|
[ext_resource type="FontFile" uid="uid://c0i81edd5mitx" path="res://font/October Crow.ttf" id="1_ndt1a"]
|
||||||
|
[ext_resource type="Script" path="res://script/Menu.cs" id="1_pfhrs"]
|
||||||
[ext_resource type="Theme" uid="uid://depo4fa5p8k8m" path="res://themes/button.tres" id="2_166c6"]
|
[ext_resource type="Theme" uid="uid://depo4fa5p8k8m" path="res://themes/button.tres" id="2_166c6"]
|
||||||
|
|
||||||
[node name="menu" type="Control"]
|
[node name="menu" type="Control"]
|
||||||
|
process_mode = 3
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_pfhrs")
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0.803922, 0, 0, 0.360784)
|
||||||
|
|
||||||
[node name="Paused" type="Label" parent="."]
|
[node name="Paused" type="Label" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -32,7 +44,7 @@ size_flags_horizontal = 4
|
|||||||
theme_override_constants/separation = 16
|
theme_override_constants/separation = 16
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="Resume3" type="Button" parent="VBoxContainer"]
|
[node name="Resume" type="Button" parent="VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme = ExtResource("2_166c6")
|
theme = ExtResource("2_166c6")
|
||||||
text = "Resume
|
text = "Resume
|
||||||
@@ -49,3 +61,7 @@ layout_mode = 2
|
|||||||
theme = ExtResource("2_166c6")
|
theme = ExtResource("2_166c6")
|
||||||
text = "Exit
|
text = "Exit
|
||||||
"
|
"
|
||||||
|
|
||||||
|
[connection signal="button_down" from="VBoxContainer/Resume" to="." method="ResumeDown"]
|
||||||
|
[connection signal="button_down" from="VBoxContainer/option" to="." method="OptionDown"]
|
||||||
|
[connection signal="button_down" from="VBoxContainer/exit" to="." method="ExitDown"]
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://4ubk6w44h4s2"]
|
[gd_scene load_steps=5 format=3 uid="uid://4ubk6w44h4s2"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://script/Player.cs" id="1_gmlsd"]
|
[ext_resource type="Script" path="res://script/Player.cs" id="1_gmlsd"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bo4q2rvn056p3" path="res://model/PatrickIdle1.png" id="2_w2lj6"]
|
[ext_resource type="Texture2D" uid="uid://bo4q2rvn056p3" path="res://model/PatrickIdle1.png" id="2_w2lj6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://co0u7xd45nxv1" path="res://scene/control/menu.tscn" id="3_6uvd0"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_5g3cc"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_5g3cc"]
|
||||||
|
|
||||||
[node name="CharacterBody2D" type="CharacterBody2D"]
|
[node name="CharacterBody2D" type="CharacterBody2D" node_paths=PackedStringArray("menu")]
|
||||||
position = Vector2(1, 1)
|
position = Vector2(1, 1)
|
||||||
motion_mode = 1
|
motion_mode = 1
|
||||||
script = ExtResource("1_gmlsd")
|
script = ExtResource("1_gmlsd")
|
||||||
Speed = 5000.0
|
Speed = 5000.0
|
||||||
|
menu = NodePath("Camera2D/menu")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_5g3cc")
|
shape = SubResource("CircleShape2D_5g3cc")
|
||||||
@@ -19,3 +21,15 @@ position = Vector2(2, 1)
|
|||||||
texture = ExtResource("2_w2lj6")
|
texture = ExtResource("2_w2lj6")
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
|
||||||
|
[node name="menu" parent="Camera2D" instance=ExtResource("3_6uvd0")]
|
||||||
|
visible = false
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -200.0
|
||||||
|
offset_top = -150.0
|
||||||
|
offset_right = -200.0
|
||||||
|
offset_bottom = -150.0
|
||||||
|
|||||||
32
script/Menu.cs
Normal file
32
script/Menu.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class Menu : Control
|
||||||
|
{
|
||||||
|
// Called when the node enters the scene tree for the first time.
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResumeDown()
|
||||||
|
{
|
||||||
|
GetTree().Paused = false;
|
||||||
|
Input.MouseMode = Input.MouseModeEnum.Hidden;
|
||||||
|
Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OptionDown()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExitDown()
|
||||||
|
{
|
||||||
|
GetTree().Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,10 @@ using System;
|
|||||||
public partial class Player : CharacterBody2D
|
public partial class Player : CharacterBody2D
|
||||||
{
|
{
|
||||||
[Export] float Speed;
|
[Export] float Speed;
|
||||||
|
|
||||||
|
[ExportGroup("controls")]
|
||||||
|
[Export] Control menu;
|
||||||
|
|
||||||
public float PixelSize = 1.0f;
|
public float PixelSize = 1.0f;
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
@@ -12,7 +16,9 @@ public partial class Player : CharacterBody2D
|
|||||||
|
|
||||||
if(Input.IsActionPressed("quit"))
|
if(Input.IsActionPressed("quit"))
|
||||||
{
|
{
|
||||||
GetTree().Quit();
|
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||||
|
GetTree().Paused= true;
|
||||||
|
menu.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user