New project

This commit is contained in:
leca 2024-05-30 02:14:08 +03:00
parent 121618c788
commit 460f561062
9 changed files with 243 additions and 0 deletions

1
icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z" fill="#478cbf"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 949 B

37
icon.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cv80337cw6xlf"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

64
project.godot Normal file
View File

@ -0,0 +1,64 @@
; 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="Godsim"
run/main_scene="res://scenes/world.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.svg"
[input]
MWU={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
MWD={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
forward={
"deadzone": 0.5,
"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":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
backward={
"deadzone": 0.5,
"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":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
left={
"deadzone": 0.5,
"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":65,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
right={
"deadzone": 0.5,
"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":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
up={
"deadzone": 0.5,
"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,"echo":false,"script":null)
]
}
down={
"deadzone": 0.5,
"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":4194326,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
run={
"deadzone": 0.5,
"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,"echo":false,"script":null)
]
}

11
scenes/models/god.tscn Normal file
View File

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://b6er1dx11vq1a"]
[ext_resource type="Script" path="res://scripts/God.gd" id="1_hfa56"]
[ext_resource type="PackedScene" uid="uid://bs7ctvbx7xov5" path="res://scenes/ui.tscn" id="2_06brk"]
[node name="God" type="Node3D"]
script = ExtResource("1_hfa56")
[node name="Camera" type="Camera3D" parent="."]
[node name="UI" parent="." instance=ExtResource("2_06brk")]

19
scenes/models/tile.tscn Normal file
View File

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://dj0odn77jplje"]
[ext_resource type="Script" path="res://scripts/Tile.gd" id="1_s01tx"]
[sub_resource type="BoxMesh" id="BoxMesh_3vjuu"]
size = Vector3(10, 5, 10)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_scykg"]
data = PackedVector3Array(-5, 2.5, 5, 5, 2.5, 5, -5, -2.5, 5, 5, 2.5, 5, 5, -2.5, 5, -5, -2.5, 5, 5, 2.5, -5, -5, 2.5, -5, 5, -2.5, -5, -5, 2.5, -5, -5, -2.5, -5, 5, -2.5, -5, 5, 2.5, 5, 5, 2.5, -5, 5, -2.5, 5, 5, 2.5, -5, 5, -2.5, -5, 5, -2.5, 5, -5, 2.5, -5, -5, 2.5, 5, -5, -2.5, -5, -5, 2.5, 5, -5, -2.5, 5, -5, -2.5, -5, 5, 2.5, 5, -5, 2.5, 5, 5, 2.5, -5, -5, 2.5, 5, -5, 2.5, -5, 5, 2.5, -5, -5, -2.5, 5, 5, -2.5, 5, -5, -2.5, -5, 5, -2.5, 5, 5, -2.5, -5, -5, -2.5, -5)
[node name="Tile" type="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.5, 0)
script = ExtResource("1_s01tx")
[node name="VisibleMesh" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_3vjuu")
[node name="CollisionMesh" type="CollisionShape3D" parent="."]
shape = SubResource("ConcavePolygonShape3D_scykg")

20
scenes/ui.tscn Normal file
View File

@ -0,0 +1,20 @@
[gd_scene format=3 uid="uid://bs7ctvbx7xov5"]
[node name="UI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 1
[node name="velocity_label" type="Label" parent="."]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -40.0
offset_bottom = 23.0
grow_horizontal = 0
text = "Speed:"

32
scenes/world.tscn Normal file
View File

@ -0,0 +1,32 @@
[gd_scene load_steps=6 format=3 uid="uid://dh52xle0rfx5r"]
[ext_resource type="PackedScene" uid="uid://b6er1dx11vq1a" path="res://scenes/models/god.tscn" id="1_vj3b2"]
[ext_resource type="PackedScene" uid="uid://dj0odn77jplje" path="res://scenes/models/tile.tscn" id="2_1y5so"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_xk8d1"]
[sub_resource type="Sky" id="Sky_wd7fg"]
sky_material = SubResource("ProceduralSkyMaterial_xk8d1")
[sub_resource type="Environment" id="Environment_4ke8e"]
background_mode = 2
sky = SubResource("Sky_wd7fg")
ambient_light_source = 3
[node name="World" type="Node3D"]
[node name="God" parent="." instance=ExtResource("1_vj3b2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 1)
[node name="Sky" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_4ke8e")
[node name="Sun" type="DirectionalLight3D" parent="Sky"]
transform = Transform3D(-0.0647024, -0.76, 0.646694, -0.0118927, 0.648593, 0.761042, -0.997834, 0.0415503, -0.051004, 0, 0, 0)
shadow_enabled = true
[node name="Earth" type="Node3D" parent="."]
[node name="Tile" parent="Earth" instance=ExtResource("2_1y5so")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.3537, -2.5, 0)
constant_linear_velocity = Vector3(10, 0, 0)

48
scripts/God.gd Normal file
View File

@ -0,0 +1,48 @@
extends Node3D
const SENSETIVITY = 0.009;
var walk = 0.25
@onready var head = $"."
@onready var camera = $"./Camera"
@onready var ui = $"./UI"
@onready var velocity_label: Label = ui.find_child("velocity_label")
func _ready():
camera.make_current()
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _unhandled_input(event):
if Input.is_action_pressed("MWU"):
walk += walk / 5.
if Input.is_action_pressed("MWD"):
walk -= walk / 5.
walk = clamp(snapped(walk, 0.0005), 0.01, 15)
if event is InputEventMouseMotion:
head.rotate_y(-event.relative.x * SENSETIVITY)
camera.rotate_x(-event.relative.y * SENSETIVITY)
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-90), deg_to_rad(90))
func _physics_process(delta):
velocity_label.text = "Velocity: " + str(walk)
var input_dir = Input.get_vector("left", "right", "forward", "backward")
#var direction = head.transform.rotation
var direction = (head.transform.basis * Vector3(input_dir.x, input_dir.x, input_dir.y)).normalized()
#var direction = (head.transform.basis * Vector2(input_dir.x, input_dir.y)).normalized()
var velocity = Vector3.ZERO
var speed
if Input.is_action_pressed("run"):
speed = walk * 2
else:
speed = walk
velocity.y = Input.get_vector("down", "up", "left", "right").x * speed
if direction:
velocity.x = direction.x * speed
velocity.z = direction.z * speed
else:
velocity.x = lerp(velocity.x, direction.x * speed, delta * 4)
velocity.z = lerp(velocity.z, direction.z * speed, delta * 4)
head.position += velocity

11
scripts/Tile.gd Normal file
View File

@ -0,0 +1,11 @@
extends StaticBody3D
# 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