diff --git a/godot/Default Orange.png b/godot/Default Orange.png new file mode 100644 index 0000000..1f222d4 --- /dev/null +++ b/godot/Default Orange.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd92a5f8727ee14e0b999726b5db2d4bdf92af815188bc73d0daff00b71a43dc +size 651 diff --git a/godot/Default Orange.png.import b/godot/Default Orange.png.import new file mode 100644 index 0000000..c7acb04 --- /dev/null +++ b/godot/Default Orange.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d3lvqr08li31r" +path.s3tc="res://.godot/imported/Default Orange.png-063fb7fe49baee9d7764c022a207ac3a.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://Default Orange.png" +dest_files=["res://.godot/imported/Default Orange.png-063fb7fe49baee9d7764c022a207ac3a.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 diff --git a/godot/Player.gd b/godot/Player.gd new file mode 100644 index 0000000..06a4c08 --- /dev/null +++ b/godot/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/godot/player.tscn b/godot/player.tscn new file mode 100644 index 0000000..31f832d --- /dev/null +++ b/godot/player.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=6 format=3 uid="uid://dbqnafgsttwth"] + +[ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"] +[ext_resource type="Texture2D" uid="uid://d3lvqr08li31r" path="res://Default Orange.png" id="2_s5i4o"] + +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_kb4ms"] + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_1e11l"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_npbs0"] +albedo_texture = ExtResource("2_s5i4o") + +[node name="Player" type="CharacterBody3D"] +script = ExtResource("1_7gpdp") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("CapsuleShape3D_kb4ms") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +mesh = SubResource("CapsuleMesh_1e11l") +surface_material_override/0 = SubResource("StandardMaterial3D_npbs0") + +[node name="PlayerCam" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5) +fov = 105.5