From 0f4e6bda9ae967eb84460b6bc1169fab168c9e28 Mon Sep 17 00:00:00 2001 From: Clevertop Date: Sat, 10 Aug 2024 14:01:51 +1000 Subject: [PATCH] Update .gitattributes, .gitignore, TestZone.tscn, and 6 more files --- .gitattributes | 2 ++ .gitignore | 13 ------------- Levels/TestZone.tscn | 39 +++++++++++++++++++++++++++++++++++++++ Scripts/Player.gd | 31 +++++++++++++++++++++++++++++++ Scripts/fpsController.gd | 12 ++++++++++++ TODO.txt | 6 ++++++ icon.svg | 1 + icon.svg.import | 38 ++++++++++++++++++++++++++++++++++++++ project.godot | 15 +++++++++++++++ 9 files changed, 144 insertions(+), 13 deletions(-) create mode 100644 .gitattributes create mode 100644 Levels/TestZone.tscn create mode 100644 Scripts/Player.gd create mode 100644 Scripts/fpsController.gd create mode 100644 TODO.txt create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 project.godot diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore index d9aac21..4709183 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,2 @@ # Godot 4+ specific ignores .godot/ - -# Godot-specific ignores -.import/ -export.cfg -export_presets.cfg - -# Imported translations (automatically generated from CSV files) -*.translation - -# Mono-specific ignores -.mono/ -data_*/ -mono_crash.*.json diff --git a/Levels/TestZone.tscn b/Levels/TestZone.tscn new file mode 100644 index 0000000..b4ea27e --- /dev/null +++ b/Levels/TestZone.tscn @@ -0,0 +1,39 @@ +[gd_scene load_steps=7 format=3 uid="uid://bojbawyoy11i4"] + +[ext_resource type="Texture2D" uid="uid://contqwyu7r114" path="res://icon.svg" id="1_gnwph"] +[ext_resource type="Script" path="res://Scripts/Player.gd" id="2_0sf88"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kgnq8"] +albedo_texture = ExtResource("1_gnwph") + +[sub_resource type="BoxMesh" id="BoxMesh_67chd"] +size = Vector3(10, 1, 10) + +[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_drsh3"] +data = PackedVector3Array(-5, 0.5, 5, 5, 0.5, 5, -5, -0.5, 5, 5, 0.5, 5, 5, -0.5, 5, -5, -0.5, 5, 5, 0.5, -5, -5, 0.5, -5, 5, -0.5, -5, -5, 0.5, -5, -5, -0.5, -5, 5, -0.5, -5, 5, 0.5, 5, 5, 0.5, -5, 5, -0.5, 5, 5, 0.5, -5, 5, -0.5, -5, 5, -0.5, 5, -5, 0.5, -5, -5, 0.5, 5, -5, -0.5, -5, -5, 0.5, 5, -5, -0.5, 5, -5, -0.5, -5, 5, 0.5, 5, -5, 0.5, 5, 5, 0.5, -5, -5, 0.5, 5, -5, 0.5, -5, 5, 0.5, -5, -5, -0.5, 5, 5, -0.5, 5, -5, -0.5, -5, 5, -0.5, 5, 5, -0.5, -5, -5, -0.5, -5) + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_5q2rg"] + +[node name="TestZone" type="Node3D"] + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +material_override = SubResource("StandardMaterial3D_kgnq8") +mesh = SubResource("BoxMesh_67chd") + +[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"] +shape = SubResource("ConcavePolygonShape3D_drsh3") + +[node name="Player" type="CharacterBody3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.83982, 0) +script = ExtResource("2_0sf88") + +[node name="MeshInstance3D2" type="MeshInstance3D" parent="Player"] +mesh = SubResource("CapsuleMesh_5q2rg") +skeleton = NodePath("../..") + +[node name="Camera3D" type="Camera3D" parent="Player"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.621505, 0) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Player"] diff --git a/Scripts/Player.gd b/Scripts/Player.gd new file mode 100644 index 0000000..91c388e --- /dev/null +++ b/Scripts/Player.gd @@ -0,0 +1,31 @@ +extends CharacterBody3D + + +const SPEED = 5.0 +const JUMP_VELOCITY = 4.5 + +# Get the gravity from the project settings to be synced with RigidBody nodes. +var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") + + +func _physics_process(delta): + # Add the gravity. + if not is_on_floor(): + velocity.y -= gravity * delta + + # Handle jump. + if Input.is_action_just_pressed("ui_accept") and is_on_floor(): + velocity.y = JUMP_VELOCITY + + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + var input_dir = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down") + var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() + if direction: + velocity.x = direction.x * SPEED + velocity.z = direction.z * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + velocity.z = move_toward(velocity.z, 0, SPEED) + + move_and_slide() diff --git a/Scripts/fpsController.gd b/Scripts/fpsController.gd new file mode 100644 index 0000000..350caa6 --- /dev/null +++ b/Scripts/fpsController.gd @@ -0,0 +1,12 @@ +extends Node3D + +@export var camera : Camera3D + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..d86b57e --- /dev/null +++ b/TODO.txt @@ -0,0 +1,6 @@ +- [ ] FPS Controller +- [ ] Chrono terminal +- [ ] commands +- [ ] level deign +- [ ] level funciton +- [ ] command functions diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..3fe4f4a --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..d350ef8 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://contqwyu7r114" +path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..610bf06 --- /dev/null +++ b/project.godot @@ -0,0 +1,15 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Chrono Chamber" +config/features=PackedStringArray("4.2", "Forward Plus") +config/icon="res://icon.svg"