Finished first EA Version #1
Binary file not shown.
@@ -3,6 +3,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://br2udyi6t8yvf" path="res://Scripts/World.cs" id="1_xkndl"]
|
[ext_resource type="Script" uid="uid://br2udyi6t8yvf" path="res://Scripts/World.cs" id="1_xkndl"]
|
||||||
[ext_resource type="Script" uid="uid://dqrdb3bvws6b6" path="res://Scripts/SteamworksHandler.cs" id="2_xkndl"]
|
[ext_resource type="Script" uid="uid://dqrdb3bvws6b6" path="res://Scripts/SteamworksHandler.cs" id="2_xkndl"]
|
||||||
[ext_resource type="Script" uid="uid://c7khr6oist3ku" path="res://Scripts/Camera3d.cs" id="3_u44n3"]
|
[ext_resource type="Script" uid="uid://c7khr6oist3ku" path="res://Scripts/Camera3d.cs" id="3_u44n3"]
|
||||||
|
[ext_resource type="Script" uid="uid://bm7knir4552j5" path="res://Scripts/Helpers/UIHandler.cs" id="4_sb48q"]
|
||||||
|
|
||||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
|
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ sky_material = SubResource("PanoramaSkyMaterial_u44n3")
|
|||||||
background_mode = 1
|
background_mode = 1
|
||||||
background_color = Color(0.27141052, 0.1874483, 0.13788113, 1)
|
background_color = Color(0.27141052, 0.1874483, 0.13788113, 1)
|
||||||
sky = SubResource("Sky_u44n3")
|
sky = SubResource("Sky_u44n3")
|
||||||
|
glow_enabled = true
|
||||||
|
|
||||||
[node name="Main" type="Node3D" unique_id=234207355]
|
[node name="Main" type="Node3D" unique_id=234207355]
|
||||||
|
|
||||||
@@ -32,3 +34,43 @@ script = ExtResource("3_u44n3")
|
|||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=377970686]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=377970686]
|
||||||
environment = SubResource("Environment_sb48q")
|
environment = SubResource("Environment_sb48q")
|
||||||
|
|
||||||
|
[node name="Control" type="Control" parent="." unique_id=1713248285]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_right = -2.0
|
||||||
|
offset_bottom = 2.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
script = ExtResource("4_sb48q")
|
||||||
|
|
||||||
|
[node name="CodingWindow" type="Panel" parent="Control" unique_id=1765248892]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 11
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -500.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="Control/CodingWindow" unique_id=2015284121]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 100.0
|
||||||
|
offset_top = 600.0
|
||||||
|
offset_right = 400.0
|
||||||
|
offset_bottom = 635.0
|
||||||
|
text = "Move"
|
||||||
|
|
||||||
|
[node name="PositionInput" type="LineEdit" parent="Control/CodingWindow" unique_id=1834676849]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 125.0
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = 375.0
|
||||||
|
offset_bottom = 85.0
|
||||||
|
placeholder_text = "Position... (X/Y OR X,Y)"
|
||||||
|
alignment = 1
|
||||||
|
|||||||
+15
-3
@@ -1,5 +1,17 @@
|
|||||||
[gd_scene format=3 uid="uid://cjae60v4c60vb"]
|
[gd_scene format=3 uid="uid://dciwxejdji2lg"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bccs6xik7xv8s" path="res://Assets/Objects/Robot.glb" id="1_8peeh"]
|
[ext_resource type="PackedScene" uid="uid://cjae60v4c60vb" path="res://Prefabs/RobotVisual.tscn" id="2_3hvm5"]
|
||||||
|
[ext_resource type="Script" uid="uid://e0pgy7jya41y" path="res://Scripts/Robot.cs" id="2_j80uv"]
|
||||||
|
|
||||||
[node name="Robot" unique_id=1113392384 instance=ExtResource("1_8peeh")]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_vquur"]
|
||||||
|
size = Vector3(1.1176758, 0.7307129, 1.0234375)
|
||||||
|
|
||||||
|
[node name="RobotBase" type="CharacterBody3D" unique_id=2075379542]
|
||||||
|
collision_layer = 2
|
||||||
|
script = ExtResource("2_j80uv")
|
||||||
|
|
||||||
|
[node name="RobotVisual" parent="." unique_id=516119901 instance=ExtResource("2_3hvm5")]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1405728816]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.05883789, 0.29821777, -0.01171875)
|
||||||
|
shape = SubResource("BoxShape3D_vquur")
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[gd_scene format=3 uid="uid://cjae60v4c60vb"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bccs6xik7xv8s" path="res://Assets/Objects/Robot.glb" id="1_wvvfd"]
|
||||||
|
|
||||||
|
[node name="Robot" unique_id=516119901 instance=ExtResource("1_wvvfd")]
|
||||||
@@ -36,4 +36,42 @@ public partial class Camera3d : Camera3D
|
|||||||
Position = new Vector3(Position.X, 10 - visibleLayer * 4, Position.Z);
|
Position = new Vector3(Position.X, 10 - visibleLayer * 4, Position.Z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void _Input(InputEvent @event)
|
||||||
|
{
|
||||||
|
if (@event is InputEventMouseButton mouse &&
|
||||||
|
mouse.ButtonIndex == MouseButton.Left &&
|
||||||
|
mouse.Pressed)
|
||||||
|
{
|
||||||
|
var camera = GetViewport().GetCamera3D();
|
||||||
|
|
||||||
|
Vector2 mousePos = mouse.Position;
|
||||||
|
|
||||||
|
Vector3 from = camera.ProjectRayOrigin(mousePos);
|
||||||
|
Vector3 to = from + camera.ProjectRayNormal(mousePos) * 1000f;
|
||||||
|
|
||||||
|
var spaceState = GetWorld3D().DirectSpaceState;
|
||||||
|
|
||||||
|
var query = PhysicsRayQueryParameters3D.Create(from, to);
|
||||||
|
|
||||||
|
query.CollisionMask = 1 << 1;
|
||||||
|
|
||||||
|
var result = spaceState.IntersectRay(query);
|
||||||
|
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
Variant colliderVariant = result["collider"];
|
||||||
|
|
||||||
|
Node hit = colliderVariant.As<Node>();
|
||||||
|
|
||||||
|
GD.Print($"Clicked robot: {hit.Name}");
|
||||||
|
|
||||||
|
// Optional: call method on robot
|
||||||
|
if (hit is Node robot)
|
||||||
|
{
|
||||||
|
robot.Call("OnClicked");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ public partial class GameData
|
|||||||
public static int currentLayer = 0;
|
public static int currentLayer = 0;
|
||||||
//The layer that is currently visible
|
//The layer that is currently visible
|
||||||
public static int visibleLayer = 0;
|
public static int visibleLayer = 0;
|
||||||
|
//Determines if the player can move the camera or not (Necessary for input and options menu)
|
||||||
|
public static bool canMove = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
public partial class UIHandler : Control
|
||||||
|
{
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
if (Input.IsActionJustPressed("codingwindow"))
|
||||||
|
{
|
||||||
|
GetNode<Panel>("./CodingWindow").Visible = !GetNode<Panel>("./CodingWindow").Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bm7knir4552j5
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
public partial class Robot : Node3D
|
||||||
|
{
|
||||||
|
public void Move()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClicked()
|
||||||
|
{
|
||||||
|
GD.Print("Test!");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://e0pgy7jya41y
|
||||||
+7
-6
@@ -16,12 +16,6 @@ public partial class World : Node3D
|
|||||||
Layer layerNode;
|
Layer layerNode;
|
||||||
|
|
||||||
private MultiMeshHandler multiMeshHandler;
|
private MultiMeshHandler multiMeshHandler;
|
||||||
FastNoiseLite noise = new FastNoiseLite()
|
|
||||||
{
|
|
||||||
NoiseType = FastNoiseLite.NoiseTypeEnum.Perlin,
|
|
||||||
Frequency = 0.05f,
|
|
||||||
Seed = 1337
|
|
||||||
};
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
@@ -90,6 +84,13 @@ public partial class World : Node3D
|
|||||||
HandleRenderData(BuildRenderData(currentLayer));
|
HandleRenderData(BuildRenderData(currentLayer));
|
||||||
visibleLayer = currentLayer;
|
visibleLayer = currentLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Input.IsActionJustPressed("spawn_robot"))
|
||||||
|
{
|
||||||
|
Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate<Robot>();
|
||||||
|
robot.Position = map[0].tiles[1,1].Position;
|
||||||
|
AddChild(robot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateWorld()
|
private void GenerateWorld()
|
||||||
|
|||||||
@@ -70,11 +70,22 @@ sprint={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
spawn_robot={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
codingwindow={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
2d_render/layer_1="BackgroundUI"
|
2d_render/layer_1="BackgroundUI"
|
||||||
2d_render/layer_2="World"
|
2d_render/layer_2="World"
|
||||||
|
3d_physics/layer_2="Robots"
|
||||||
|
|
||||||
[steam]
|
[steam]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user