Initial
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
/android/
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"godotTools.editorPath.godot4": "/var/lib/flatpak/app/org.godotengine.Godot/current/active/export/bin/org.godotengine.Godot",
|
||||||
|
"editor.insertSpaces": false,
|
||||||
|
"editor.tabSize": 4,
|
||||||
|
"terminal.integrated.tabs.enabled": false
|
||||||
|
}
|
1
icon.svg
Normal file
1
icon.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" 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"/><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" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
After Width: | Height: | Size: 994 B |
37
icon.svg.import
Normal file
37
icon.svg.import
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cu1hvpqmqn31n"
|
||||||
|
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
|
BIN
models/test.blend
Normal file
BIN
models/test.blend
Normal file
Binary file not shown.
51
models/test.blend.import
Normal file
51
models/test.blend.import
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://c7g5kc0m1uhxa"
|
||||||
|
path="res://.godot/imported/test.blend-c501d2978761adab01d4cc9b69942fee.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://models/test.blend"
|
||||||
|
dest_files=["res://.godot/imported/test.blend-c501d2978761adab01d4cc9b69942fee.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
_subresources={}
|
||||||
|
blender/nodes/visible=0
|
||||||
|
blender/nodes/active_collection_only=false
|
||||||
|
blender/nodes/punctual_lights=true
|
||||||
|
blender/nodes/cameras=true
|
||||||
|
blender/nodes/custom_properties=true
|
||||||
|
blender/nodes/modifiers=1
|
||||||
|
blender/meshes/colors=false
|
||||||
|
blender/meshes/uvs=true
|
||||||
|
blender/meshes/normals=true
|
||||||
|
blender/meshes/tangents=true
|
||||||
|
blender/meshes/skins=2
|
||||||
|
blender/meshes/export_bones_deforming_mesh_only=false
|
||||||
|
blender/materials/unpack_enabled=true
|
||||||
|
blender/materials/export_materials=1
|
||||||
|
blender/animation/limit_playback=true
|
||||||
|
blender/animation/always_sample=true
|
||||||
|
blender/animation/group_tracks=true
|
BIN
models/test.blend1
Normal file
BIN
models/test.blend1
Normal file
Binary file not shown.
62
project.godot
Normal file
62
project.godot
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
; 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="Dawn Godot"
|
||||||
|
run/main_scene="res://scenes/TestScene.tscn"
|
||||||
|
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[dotnet]
|
||||||
|
|
||||||
|
project/assembly_name="Dawn Godot"
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
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,"location":0,"echo":false,"script":null)
|
||||||
|
, 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":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"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,"location":0,"echo":false,"script":null)
|
||||||
|
, 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":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
, 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":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
|
, 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":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
interact={
|
||||||
|
"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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||||
|
, 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":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
renderer/rendering_method.mobile="gl_compatibility"
|
24
scenes/Maps/test.tscn
Normal file
24
scenes/Maps/test.tscn
Normal file
File diff suppressed because one or more lines are too long
37
scenes/NPC/Rosa.tscn
Normal file
37
scenes/NPC/Rosa.tscn
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[gd_scene load_steps=8 format=3 uid="uid://yhtpoum3eek7"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/RosaController.gd" id="1_3g383"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/RosaCamera.gd" id="2_tr66j"]
|
||||||
|
[ext_resource type="Shader" path="res://shaders/NPC Shader.gdshader" id="3_j5vis"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://i34vweii6joy" path="res://textures/rosa.png" id="4_qdjyy"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ls7r8"]
|
||||||
|
radius = 9.35148
|
||||||
|
height = 31.3716
|
||||||
|
|
||||||
|
[sub_resource type="QuadMesh" id="QuadMesh_dyaax"]
|
||||||
|
size = Vector2(32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fegux"]
|
||||||
|
render_priority = 0
|
||||||
|
shader = ExtResource("3_j5vis")
|
||||||
|
shader_parameter/frame = 0
|
||||||
|
shader_parameter/direction = 1
|
||||||
|
shader_parameter/npcTexture = ExtResource("4_qdjyy")
|
||||||
|
|
||||||
|
[node name="Rosa" type="CharacterBody3D"]
|
||||||
|
script = ExtResource("1_3g383")
|
||||||
|
|
||||||
|
[node name="Rosa Camera" type="Camera3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.130388, 0.991463, 0, -0.991463, 0.130388, 0, 30.9255, 0)
|
||||||
|
fov = 30.0
|
||||||
|
script = ExtResource("2_tr66j")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5.93694)
|
||||||
|
shape = SubResource("CapsuleShape3D_ls7r8")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.173648, 0.984808, 0, -0.984808, 0.173648, 0, 0, 0)
|
||||||
|
mesh = SubResource("QuadMesh_dyaax")
|
||||||
|
surface_material_override/0 = SubResource("ShaderMaterial_fegux")
|
31
scenes/NPC/TestNPC.tscn
Normal file
31
scenes/NPC/TestNPC.tscn
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://dr4b2pmsknuhc"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/TestNPCController.gd" id="1_61g2d"]
|
||||||
|
[ext_resource type="Shader" path="res://shaders/NPC Shader.gdshader" id="1_xgcv1"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://i34vweii6joy" path="res://textures/rosa.png" id="2_shls4"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_32cew"]
|
||||||
|
radius = 9.35148
|
||||||
|
height = 31.3716
|
||||||
|
|
||||||
|
[sub_resource type="QuadMesh" id="QuadMesh_evcrc"]
|
||||||
|
size = Vector2(32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mgbpu"]
|
||||||
|
render_priority = 0
|
||||||
|
shader = ExtResource("1_xgcv1")
|
||||||
|
shader_parameter/frame = 0
|
||||||
|
shader_parameter/direction = 1
|
||||||
|
shader_parameter/npcTexture = ExtResource("2_shls4")
|
||||||
|
|
||||||
|
[node name="TestNpc" type="CharacterBody3D"]
|
||||||
|
script = ExtResource("1_61g2d")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5.93694)
|
||||||
|
shape = SubResource("CapsuleShape3D_32cew")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.173648, 0.984808, 0, -0.984808, 0.173648, 0, 0, 0)
|
||||||
|
mesh = SubResource("QuadMesh_evcrc")
|
||||||
|
surface_material_override/0 = SubResource("ShaderMaterial_mgbpu")
|
36
scenes/TestScene.tscn
Normal file
36
scenes/TestScene.tscn
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://bdrpqtbwvtivd"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/NPC/Rosa.tscn" id="1_3u2u0"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/NPC/TestNPC.tscn" id="2_6f3lj"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://7wjfo6u4dp3h" path="res://scenes/Maps/test.tscn" id="4_18e1y"]
|
||||||
|
|
||||||
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_1b6it"]
|
||||||
|
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
|
||||||
|
sky_energy_multiplier = 0.0
|
||||||
|
ground_bottom_color = Color(0, 0, 0, 1)
|
||||||
|
ground_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
|
||||||
|
|
||||||
|
[sub_resource type="Sky" id="Sky_weucl"]
|
||||||
|
sky_material = SubResource("ProceduralSkyMaterial_1b6it")
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_18twt"]
|
||||||
|
background_mode = 2
|
||||||
|
sky = SubResource("Sky_weucl")
|
||||||
|
|
||||||
|
[node name="TestSceneRoot" type="Node3D"]
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_18twt")
|
||||||
|
|
||||||
|
[node name="Rosa" parent="." instance=ExtResource("1_3u2u0")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -24.3489, 25.4112, -33.4617)
|
||||||
|
|
||||||
|
[node name="TestNpc" parent="." instance=ExtResource("2_6f3lj")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15.919, 28.7961, 27.6146)
|
||||||
|
|
||||||
|
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -38.1432, 54.7591, -25.7675)
|
||||||
|
light_energy = 15.315
|
||||||
|
omni_range = 281.646
|
||||||
|
|
||||||
|
[node name="test" parent="." instance=ExtResource("4_18e1y")]
|
61
scripts/OverworldEntity.gd
Normal file
61
scripts/OverworldEntity.gd
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
extends CharacterBody3D
|
||||||
|
|
||||||
|
enum Direction {
|
||||||
|
NORTH,
|
||||||
|
SOUTH,
|
||||||
|
WEST,
|
||||||
|
EAST
|
||||||
|
}
|
||||||
|
|
||||||
|
var speed:float = 3200;
|
||||||
|
var friction:float = 7;
|
||||||
|
var gravity:float = 150;
|
||||||
|
|
||||||
|
var direction = Direction.SOUTH;
|
||||||
|
var meshInstance:MeshInstance3D;
|
||||||
|
|
||||||
|
func getDirectionVector() -> Vector3:
|
||||||
|
match direction:
|
||||||
|
Direction.NORTH:
|
||||||
|
return Vector3(0, 0, -1);
|
||||||
|
Direction.SOUTH:
|
||||||
|
return Vector3(0, 0, 1);
|
||||||
|
Direction.WEST:
|
||||||
|
return Vector3(-1, 0, 0);
|
||||||
|
Direction.EAST:
|
||||||
|
return Vector3(1, 0, 0);
|
||||||
|
return Vector3(0, 0, 0);
|
||||||
|
|
||||||
|
# Virtual Methods
|
||||||
|
func updateMovement(delta) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func updateOverworldLogic(delta) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Events
|
||||||
|
func _ready() -> void:
|
||||||
|
meshInstance = get_node("MeshInstance3D")
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(delta:float) -> void:
|
||||||
|
# Update logic
|
||||||
|
updateOverworldLogic(delta)
|
||||||
|
|
||||||
|
# Set shader direction.
|
||||||
|
var material:ShaderMaterial = meshInstance.get_surface_override_material(0)
|
||||||
|
material.set_shader_parameter("direction", direction)
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
# Gravity and friction
|
||||||
|
if !is_on_floor():
|
||||||
|
velocity.y -= gravity * delta;
|
||||||
|
else:
|
||||||
|
velocity += -(velocity * friction * delta);
|
||||||
|
|
||||||
|
# Update movement
|
||||||
|
updateMovement(delta)
|
||||||
|
|
||||||
|
# Update character controller.
|
||||||
|
move_and_slide();
|
23
scripts/RosaCamera.gd
Normal file
23
scripts/RosaCamera.gd
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
extends Camera3D
|
||||||
|
|
||||||
|
var PIXEL_SCALE:float = 4.0;
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
var z:float = (
|
||||||
|
tan((deg_to_rad(180) - deg_to_rad(fov)) / 2.0) *
|
||||||
|
(get_viewport().size.y / 2.0)
|
||||||
|
) / PIXEL_SCALE;
|
||||||
|
|
||||||
|
var rosa = get_node("..");
|
||||||
|
var look = rosa.position;
|
||||||
|
var position = Vector3(0, 0, 4) + look;
|
||||||
|
look_at_from_position(
|
||||||
|
Vector3(position.x, position.y + z, position.z),
|
||||||
|
look
|
||||||
|
);
|
||||||
|
|
||||||
|
pass
|
50
scripts/RosaController.gd
Normal file
50
scripts/RosaController.gd
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
extends "res://scripts/OverworldEntity.gd"
|
||||||
|
|
||||||
|
var interactRange = 22;
|
||||||
|
|
||||||
|
func updateOverworldLogic(delta) -> void:
|
||||||
|
# Check if interact button is pressed
|
||||||
|
if(Input.is_action_just_pressed("interact")):
|
||||||
|
var rayDirection = getDirectionVector();
|
||||||
|
# cast ray
|
||||||
|
|
||||||
|
var query = PhysicsRayQueryParameters3D.create(
|
||||||
|
position,
|
||||||
|
position + (rayDirection * interactRange)
|
||||||
|
)
|
||||||
|
query.collide_with_areas = true
|
||||||
|
query.exclude = [self]
|
||||||
|
|
||||||
|
var result = get_world_3d().direct_space_state.intersect_ray(query)
|
||||||
|
if result and result.collider:
|
||||||
|
var collider = result.collider
|
||||||
|
if(collider.has_method("interact")):
|
||||||
|
collider.interact(self)
|
||||||
|
|
||||||
|
func updateMovement(delta) -> void:
|
||||||
|
# User movement
|
||||||
|
var dir:Vector2 = Input.get_vector("left", "right", "up", "down");
|
||||||
|
if(dir.x != 0 or dir.y != 0):
|
||||||
|
velocity.x = dir.x * speed * delta;
|
||||||
|
velocity.z = dir.y * speed * delta;
|
||||||
|
|
||||||
|
# Update direction
|
||||||
|
if(dir.x > 0):
|
||||||
|
if(
|
||||||
|
dir.y == 0 or
|
||||||
|
(dir.y < 0 and direction == Direction.SOUTH) or
|
||||||
|
(dir.y > 0 and direction == Direction.NORTH)
|
||||||
|
):
|
||||||
|
direction = Direction.EAST;
|
||||||
|
elif (dir.x < 0):
|
||||||
|
if(
|
||||||
|
dir.y == 0 or
|
||||||
|
(dir.y < 0 and direction == Direction.SOUTH) or
|
||||||
|
(dir.y > 0 and direction == Direction.NORTH)
|
||||||
|
):
|
||||||
|
direction = Direction.WEST;
|
||||||
|
elif (dir.y > 0):
|
||||||
|
direction = Direction.SOUTH;
|
||||||
|
elif (dir.y < 0):
|
||||||
|
direction = Direction.NORTH;
|
||||||
|
pass
|
34
scripts/TestNPCController.gd
Normal file
34
scripts/TestNPCController.gd
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
extends "res://scripts/OverworldEntity.gd"
|
||||||
|
|
||||||
|
func interact(interactor) -> void:
|
||||||
|
print("Hello, I am an NPC!")
|
||||||
|
pass
|
||||||
|
|
||||||
|
func updateMovement(delta) -> void:
|
||||||
|
pass
|
||||||
|
# User movement
|
||||||
|
#var dir:Vector2 = Input.get_vector("left", "right", "up", "down");
|
||||||
|
#if(dir.x != 0 or dir.y != 0):
|
||||||
|
#velocity.x = dir.x * speed * delta;
|
||||||
|
#velocity.z = dir.y * speed * delta;
|
||||||
|
#
|
||||||
|
## Update direction
|
||||||
|
#if(dir.x > 0):
|
||||||
|
#if(
|
||||||
|
#dir.y == 0 or
|
||||||
|
#(dir.y < 0 and direction == Direction.SOUTH) or
|
||||||
|
#(dir.y > 0 and direction == Direction.NORTH)
|
||||||
|
#):
|
||||||
|
#direction = Direction.EAST;
|
||||||
|
#elif (dir.x < 0):
|
||||||
|
#if(
|
||||||
|
#dir.y == 0 or
|
||||||
|
#(dir.y < 0 and direction == Direction.SOUTH) or
|
||||||
|
#(dir.y > 0 and direction == Direction.NORTH)
|
||||||
|
#):
|
||||||
|
#direction = Direction.WEST;
|
||||||
|
#elif (dir.y > 0):
|
||||||
|
#direction = Direction.SOUTH;
|
||||||
|
#elif (dir.y < 0):
|
||||||
|
#direction = Direction.NORTH;
|
||||||
|
#pass
|
17
shaders/Map Shader.gdshader
Normal file
17
shaders/Map Shader.gdshader
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
shader_type spatial;
|
||||||
|
render_mode cull_disabled;
|
||||||
|
|
||||||
|
uniform sampler2D tileset : filter_nearest;
|
||||||
|
|
||||||
|
void vertex() {
|
||||||
|
// Called for every vertex the material is visible on.
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec4 textureColor = texture(tileset, UV);
|
||||||
|
|
||||||
|
if(textureColor.a == 0.0)
|
||||||
|
discard;
|
||||||
|
|
||||||
|
ALBEDO = textureColor.rgb;
|
||||||
|
}
|
58
shaders/NPC Shader.gdshader
Normal file
58
shaders/NPC Shader.gdshader
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
shader_type spatial;
|
||||||
|
render_mode cull_disabled;
|
||||||
|
|
||||||
|
uniform sampler2D npcTexture : filter_nearest;
|
||||||
|
uniform int frame;
|
||||||
|
uniform int direction;
|
||||||
|
|
||||||
|
const int FRAMES = 3;
|
||||||
|
const int DIRECTIONS = 4;
|
||||||
|
//const bool BILLBOARD_ROTATION_LOCK = false;
|
||||||
|
|
||||||
|
void vertex() {
|
||||||
|
//if(BILLBOARD_ROTATION_LOCK) {
|
||||||
|
//mat4 modified_model_view = VIEW_MATRIX * mat4(
|
||||||
|
//INV_VIEW_MATRIX[0],
|
||||||
|
//INV_VIEW_MATRIX[1],
|
||||||
|
//INV_VIEW_MATRIX[2],
|
||||||
|
//MODEL_MATRIX[3]
|
||||||
|
//);
|
||||||
|
//MODELVIEW_MATRIX = modified_model_view;
|
||||||
|
//} else {
|
||||||
|
//mat4 modified_model_view = VIEW_MATRIX * mat4(
|
||||||
|
//INV_VIEW_MATRIX[0],
|
||||||
|
//MODEL_MATRIX[1],
|
||||||
|
//MODEL_MATRIX[2],
|
||||||
|
//MODEL_MATRIX[3]
|
||||||
|
//);
|
||||||
|
//MODELVIEW_MATRIX = modified_model_view;
|
||||||
|
//}
|
||||||
|
|
||||||
|
vec2 tileSize = vec2(1.0 / float(FRAMES), 1.0 / float(DIRECTIONS));
|
||||||
|
vec2 topLeft = tileSize * vec2(float(frame % FRAMES), float(direction % DIRECTIONS));
|
||||||
|
vec2 bottomRight = topLeft + tileSize;
|
||||||
|
|
||||||
|
if(VERTEX_ID == 3) {
|
||||||
|
UV = topLeft;
|
||||||
|
} else if(VERTEX_ID == 2) {
|
||||||
|
UV = vec2(bottomRight.x, topLeft.y);
|
||||||
|
} else if(VERTEX_ID == 1) {
|
||||||
|
UV = vec2(topLeft.x, bottomRight.y);
|
||||||
|
} else if(VERTEX_ID == 0) {
|
||||||
|
UV = bottomRight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec4 npcColor = texture(npcTexture, UV);
|
||||||
|
|
||||||
|
// Remove PINK background
|
||||||
|
if(npcColor.r == 1.0 && npcColor.g == 0.0 && npcColor.b == 1.0)
|
||||||
|
discard;
|
||||||
|
|
||||||
|
// Remove GREEN borders
|
||||||
|
if(npcColor.r == 0.00392156862745 && npcColor.g == 1.0 && npcColor.b == 0.0)
|
||||||
|
discard;
|
||||||
|
|
||||||
|
ALBEDO.rgb = npcColor.rgb;
|
||||||
|
}
|
BIN
textures/rosa.png
Normal file
BIN
textures/rosa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
34
textures/rosa.png.import
Normal file
34
textures/rosa.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://i34vweii6joy"
|
||||||
|
path="res://.godot/imported/rosa.png-7b997e40701d7585aa27d5b60f198c06.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://textures/rosa.png"
|
||||||
|
dest_files=["res://.godot/imported/rosa.png-7b997e40701d7585aa27d5b60f198c06.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=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
|
BIN
textures/tileset.png
Normal file
BIN
textures/tileset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
35
textures/tileset.png.import
Normal file
35
textures/tileset.png.import
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ehx42m4jdu6h"
|
||||||
|
path.s3tc="res://.godot/imported/tileset.png-c58e1bf82d47fc19d60aef6c7192e952.s3tc.ctex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc_bptc"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://textures/tileset.png"
|
||||||
|
dest_files=["res://.godot/imported/tileset.png-c58e1bf82d47fc19d60aef6c7192e952.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
|
Reference in New Issue
Block a user