From 5573ad815f868a727539763bd3190cc58ce9f4d7 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Fri, 28 Nov 2025 15:11:58 -0600 Subject: [PATCH] Rendering how I want for now --- .vscode/settings.json | 4 +- cutscene/Cutscene.gd | 42 +++++++------- cutscene/item/CutsceneText.gd | 24 ++++---- entity/EntityMovement.gd | 75 ++---------------------- entity/npc/NPC.gd | 9 --- entity/npc/NPC.tscn | 98 ++++++++------------------------ entity/player/Player.gd | 17 ++---- entity/player/Player.tscn | 99 ++++++++++---------------------- entity/player/PlayerCamera.gd | 32 +++++------ map/TestMap.tscn | 7 ++- project.godot | 7 +-- singleton/Load.gd | 40 ++++++------- singleton/Scene.gd | 16 +++--- singleton/Transition.gd | 104 +++++++++++++++++----------------- singleton/UI.gd | 1 - 15 files changed, 199 insertions(+), 376 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4340040..f50746a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,8 @@ { "godotTools.editorPath.godot4": "/var/lib/flatpak/app/org.godotengine.Godot/current/active/export/bin/org.godotengine.Godot", "terminal.integrated.tabs.enabled": false, - "editor.insertSpaces": false, - "editor.tabSize": 4, + "editor.insertSpaces": true, + "editor.tabSize": 2, "files.exclude": { "**/*.uid": true }, diff --git a/cutscene/Cutscene.gd b/cutscene/Cutscene.gd index c5b5811..eb33fd9 100644 --- a/cutscene/Cutscene.gd +++ b/cutscene/Cutscene.gd @@ -4,29 +4,29 @@ var items:Array[CutsceneItem] = [] var itemIndex:int = 0 func _enter_tree() -> void: - # Get children - var children = get_children() - for child in children: - if !(child is CutsceneItem): - continue - items.append(child) - pass + # Get children + var children = get_children() + for child in children: + if !(child is CutsceneItem): + continue + items.append(child) + pass func _exit_tree() -> void: - items.clear() - pass + items.clear() + pass func start() -> void: - itemIndex = -1 - if items.size() == 0: - return - nextItem() - + itemIndex = -1 + if items.size() == 0: + return + nextItem() + func nextItem() -> void: - itemIndex += 1 - if itemIndex >= items.size(): - return - - var item = items[itemIndex] - item.cutscene = self - item.start() \ No newline at end of file + itemIndex += 1 + if itemIndex >= items.size(): + return + + var item = items[itemIndex] + item.cutscene = self + item.start() \ No newline at end of file diff --git a/cutscene/item/CutsceneText.gd b/cutscene/item/CutsceneText.gd index dc3b19c..31aeb9a 100644 --- a/cutscene/item/CutsceneText.gd +++ b/cutscene/item/CutsceneText.gd @@ -4,21 +4,21 @@ class_name CutsceneText extends CutsceneItem var nextTextIndex:int = 0 func _enter_tree() -> void: - pass + pass func _exit_tree() -> void: - UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing) + UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing) func start() -> void: - nextTextIndex = 0 - UI.TEXTBOX.setText(interactTexts[nextTextIndex]) - UI.TEXTBOX.textboxClosing.connect(onTextboxClosing) + nextTextIndex = 0 + UI.TEXTBOX.setText(interactTexts[nextTextIndex]) + UI.TEXTBOX.textboxClosing.connect(onTextboxClosing) func onTextboxClosing() -> void: - nextTextIndex += 1 - if nextTextIndex < interactTexts.size(): - UI.TEXTBOX.setText(interactTexts[nextTextIndex]) - else: - UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing) - UI.TEXTBOX.setText("") - done() \ No newline at end of file + nextTextIndex += 1 + if nextTextIndex < interactTexts.size(): + UI.TEXTBOX.setText(interactTexts[nextTextIndex]) + else: + UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing) + UI.TEXTBOX.setText("") + done() \ No newline at end of file diff --git a/entity/EntityMovement.gd b/entity/EntityMovement.gd index 455c317..0ad57da 100644 --- a/entity/EntityMovement.gd +++ b/entity/EntityMovement.gd @@ -2,82 +2,20 @@ class_name EntityMovement extends Node const FRICTION = 0.01 - -enum FacingDirection { - SOUTH = 0, - EAST = 1, - NORTH = 2, - WEST = 3 -}; - -const FacingDirWalkAnimations = { - FacingDirection.SOUTH: "walk_south", - FacingDirection.EAST: "walk_east", - FacingDirection.NORTH: "walk_north", - FacingDirection.WEST: "walk_west" -}; - -const FacingDirAngle = { - FacingDirection.SOUTH: 0.0, - FacingDirection.EAST: PI / 2, - FacingDirection.NORTH: PI, - FacingDirection.WEST: -PI / 2 -}; +const WALK_SPEED_DEFAULT = 8 +const RUN_SPEED_DEFAULT = 12 var _inputDir:Vector2 = Vector2.ZERO -var _facingDir:FacingDirection = FacingDirection.SOUTH var _running:bool = false @export var body:CharacterBody3D @export var rotate:Node3D -@export var sprite:AnimatedSprite3D -@export var walkSpeed:float = 48.0 -@export var runSpeed:float = 64.0 -@export var facingDir:FacingDirection = FacingDirection.SOUTH: - set(value): - _facingDir = value - _updateSprite() - get: - return _facingDir +@export var walkSpeed:float = WALK_SPEED_DEFAULT +@export var runSpeed:float = RUN_SPEED_DEFAULT # # Private Methods # -func _updateSprite() -> void: - if !sprite || sprite.animation == FacingDirWalkAnimations[facingDir]: - return - sprite.animation = FacingDirWalkAnimations[facingDir] - - -func _applyFacingDir() -> void: - if !sprite || _inputDir.length() <= 0.01: - return - - if _inputDir.y > 0: - if facingDir != FacingDirection.NORTH && _inputDir.x != 0: - if _inputDir.x > 0 && facingDir == FacingDirection.EAST: - facingDir = FacingDirection.EAST - elif _inputDir.x < 0 && facingDir == FacingDirection.WEST: - facingDir = FacingDirection.WEST - else: - facingDir = FacingDirection.NORTH - else: - facingDir = FacingDirection.NORTH - elif _inputDir.y < 0: - if facingDir != FacingDirection.SOUTH && _inputDir.x != 0: - if _inputDir.x > 0 && facingDir == FacingDirection.EAST: - facingDir = FacingDirection.EAST - elif _inputDir.x < 0 && facingDir == FacingDirection.WEST: - facingDir = FacingDirection.WEST - else: - facingDir = FacingDirection.SOUTH - else: - facingDir = FacingDirection.SOUTH - elif _inputDir.x > 0: - facingDir = FacingDirection.EAST - else: - facingDir = FacingDirection.WEST - func _applyGravity() -> void: if !body.is_on_floor(): body.velocity += PHYSICS.GRAVITY * get_process_delta_time() @@ -123,7 +61,7 @@ func _applyFriction(delta:float) -> void: body.velocity.z *= delta * FRICTION # -# Protected Methods +# Protected Methods # func canMove() -> bool: return true @@ -132,7 +70,7 @@ func canMove() -> bool: # Callbacks # func _enter_tree() -> void: - _updateSprite() + pass func _physics_process(delta:float) -> void: if Engine.is_editor_hint(): @@ -144,5 +82,4 @@ func _physics_process(delta:float) -> void: _applyGravity() _applyFriction(delta) _applyMovement() - _applyFacingDir() body.move_and_slide() diff --git a/entity/npc/NPC.gd b/entity/npc/NPC.gd index 32e07ff..3f23124 100644 --- a/entity/npc/NPC.gd +++ b/entity/npc/NPC.gd @@ -3,15 +3,6 @@ class_name NPC extends CharacterBody3D @export var _movement:NPCMovement -@export var facingDirection:EntityMovement.FacingDirection: - set(value): - if _movement: - _movement.facingDir = value - get: - if _movement: - return _movement.facingDir - return EntityMovement.FacingDirection.SOUTH - @export var walkSpeed:float = 48.0: set(value): if _movement: diff --git a/entity/npc/NPC.tscn b/entity/npc/NPC.tscn index 34ad6f5..9d7df01 100644 --- a/entity/npc/NPC.tscn +++ b/entity/npc/NPC.tscn @@ -1,96 +1,48 @@ -[gd_scene load_steps=12 format=3 uid="uid://kabs7mopalmo"] +[gd_scene load_steps=8 format=3 uid="uid://kabs7mopalmo"] [ext_resource type="Script" uid="uid://crw7ls7t8cwct" path="res://entity/npc/NPC.gd" id="1_00k55"] [ext_resource type="Script" uid="uid://b00rxpveu3v4m" path="res://InteractableArea.gd" id="2_x8luf"] [ext_resource type="Script" uid="uid://tlfthv88ki0y" path="res://entity/npc/NPCMovement.gd" id="3_1seh5"] -[ext_resource type="Texture2D" uid="uid://xx3qp5xh7tgu" path="res://entity/player/Player.png" id="4_x8luf"] -[sub_resource type="BoxShape3D" id="BoxShape3D_1seh5"] -size = Vector3(16, 16, 16) +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jphom"] -[sub_resource type="AtlasTexture" id="AtlasTexture_rl6fg"] -atlas = ExtResource("4_x8luf") -region = Rect2(16, 0, 16, 16) +[sub_resource type="BoxShape3D" id="BoxShape3D_jphom"] +size = Vector3(1, 2, 1) -[sub_resource type="AtlasTexture" id="AtlasTexture_q57vx"] -atlas = ExtResource("4_x8luf") -region = Rect2(48, 0, 16, 16) +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jphom"] +shading_mode = 0 -[sub_resource type="AtlasTexture" id="AtlasTexture_ak4un"] -atlas = ExtResource("4_x8luf") -region = Rect2(0, 0, 16, 16) - -[sub_resource type="AtlasTexture" id="AtlasTexture_1ms0h"] -atlas = ExtResource("4_x8luf") -region = Rect2(32, 0, 16, 16) - -[sub_resource type="SpriteFrames" id="SpriteFrames_1seh5"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_rl6fg") -}], -"loop": true, -"name": &"walk_east", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_q57vx") -}], -"loop": true, -"name": &"walk_north", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_ak4un") -}], -"loop": true, -"name": &"walk_south", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_1ms0h") -}], -"loop": true, -"name": &"walk_west", -"speed": 5.0 -}] - -[sub_resource type="SphereShape3D" id="SphereShape3D_x8luf"] -radius = 8.5 +[sub_resource type="CapsuleMesh" id="CapsuleMesh_jphom"] +material = SubResource("StandardMaterial3D_jphom") [node name="NPC" type="CharacterBody3D" node_paths=PackedStringArray("_movement")] script = ExtResource("1_00k55") +facingDirection = null +walkSpeed = null +runSpeed = null _movement = NodePath("Scripts/NPCMovement") [node name="Scripts" type="Node" parent="."] -[node name="NPCMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body", "sprite")] +[node name="NPCMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body")] script = ExtResource("3_1seh5") body = NodePath("../..") -sprite = NodePath("../../AnimatedSprite3D") -[node name="InteractableArea" type="Area3D" parent="."] +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("CapsuleShape3D_jphom") + +[node name="Rotate" type="Node3D" parent="."] + +[node name="InteractableArea" type="Area3D" parent="Rotate"] script = ExtResource("2_x8luf") metadata/_custom_type_script = "uid://b00rxpveu3v4m" -[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableArea"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8, 0) -shape = SubResource("BoxShape3D_1seh5") +[node name="InteractableShape" type="CollisionShape3D" parent="Rotate/InteractableArea"] +transform = Transform3D(0.999999, -0.000856732, 0.0007724, 0.000857588, 0.999999, -0.00114162, -0.000771449, 0.00114226, 0.999999, 0, 0, 0) +shape = SubResource("BoxShape3D_jphom") -[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."] -pixel_size = 1.0 -axis = 1 -double_sided = false -texture_filter = 0 -sprite_frames = SubResource("SpriteFrames_1seh5") -animation = &"walk_south" +[node name="CapsuleMesh" type="MeshInstance3D" parent="Rotate"] +mesh = SubResource("CapsuleMesh_jphom") +skeleton = NodePath("../..") -[node name="CollisionShape3D" type="CollisionShape3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.5, 0) -shape = SubResource("SphereShape3D_x8luf") - -[connection signal="interactEvent" from="InteractableArea" to="." method="onInteract"] +[connection signal="interactEvent" from="Rotate/InteractableArea" to="." method="onInteract"] diff --git a/entity/player/Player.gd b/entity/player/Player.gd index ed8534a..074c62f 100644 --- a/entity/player/Player.gd +++ b/entity/player/Player.gd @@ -3,29 +3,20 @@ class_name Player extends CharacterBody3D @export var _movement:PlayerMovement -@export var facingDirection:EntityMovement.FacingDirection: - set(value): - if _movement: - _movement.facingDir = value - get: - if _movement: - return _movement.facingDir - return EntityMovement.FacingDirection.SOUTH - -@export var walkSpeed:float = 48.0: +@export var walkSpeed:float = EntityMovement.WALK_SPEED_DEFAULT: set(value): if _movement: _movement.walkSpeed = value get: if _movement: return _movement.walkSpeed - return 48.0 + return EntityMovement.WALK_SPEED_DEFAULT -@export var runSpeed:float = 64.0: +@export var runSpeed:float = EntityMovement.RUN_SPEED_DEFAULT: set(value): if _movement: _movement.runSpeed = value get: if _movement: return _movement.runSpeed - return 64.0 + return EntityMovement.RUN_SPEED_DEFAULT diff --git a/entity/player/Player.tscn b/entity/player/Player.tscn index 6ec64de..4c7d2ed 100644 --- a/entity/player/Player.tscn +++ b/entity/player/Player.tscn @@ -1,68 +1,29 @@ -[gd_scene load_steps=14 format=3 uid="uid://2ch34sio36nv"] +[gd_scene load_steps=12 format=3 uid="uid://2ch34sio36nv"] [ext_resource type="Script" uid="uid://ylmy3nvpirgr" path="res://entity/player/Player.gd" id="1_24gqh"] [ext_resource type="Script" uid="uid://bwxdv3kxrs4oj" path="res://entity/player/PlayerMovement.gd" id="2_o7et6"] [ext_resource type="Script" uid="uid://b3nty7pvbo58d" path="res://entity/player/PlayerInteraction.gd" id="3_24gqh"] [ext_resource type="Script" uid="uid://bdv1fj1pwknrs" path="res://entity/player/PlayerInput.gd" id="4_yjynp"] [ext_resource type="Script" uid="uid://bdjgvyiacbg28" path="res://entity/player/PlayerCamera.gd" id="5_g3lhm"] -[ext_resource type="Texture2D" uid="uid://xx3qp5xh7tgu" path="res://entity/player/Player.png" id="7_fmb3c"] -[sub_resource type="SphereShape3D" id="SphereShape3D_4pwj0"] -radius = 8.5 +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rykwh"] -[sub_resource type="AtlasTexture" id="AtlasTexture_rl6fg"] -atlas = ExtResource("7_fmb3c") -region = Rect2(16, 0, 16, 16) +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rykwh"] +shading_mode = 0 -[sub_resource type="AtlasTexture" id="AtlasTexture_q57vx"] -atlas = ExtResource("7_fmb3c") -region = Rect2(48, 0, 16, 16) +[sub_resource type="CapsuleMesh" id="CapsuleMesh_etv1g"] +material = SubResource("StandardMaterial3D_rykwh") -[sub_resource type="AtlasTexture" id="AtlasTexture_ak4un"] -atlas = ExtResource("7_fmb3c") -region = Rect2(0, 0, 16, 16) +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_etv1g"] +shading_mode = 0 +albedo_color = Color(0.376471, 1, 1, 1) -[sub_resource type="AtlasTexture" id="AtlasTexture_1ms0h"] -atlas = ExtResource("7_fmb3c") -region = Rect2(32, 0, 16, 16) - -[sub_resource type="SpriteFrames" id="SpriteFrames_2rv2u"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_rl6fg") -}], -"loop": true, -"name": &"walk_east", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_q57vx") -}], -"loop": true, -"name": &"walk_north", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_ak4un") -}], -"loop": true, -"name": &"walk_south", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_1ms0h") -}], -"loop": true, -"name": &"walk_west", -"speed": 5.0 -}] +[sub_resource type="BoxMesh" id="BoxMesh_m44ds"] +material = SubResource("StandardMaterial3D_etv1g") +size = Vector3(0.4, 0.4, 0.4) [sub_resource type="BoxShape3D" id="BoxShape3D_g13of"] -size = Vector3(10, 16, 8) +size = Vector3(1.14069, 1, 1.38867) [node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("_movement")] script = ExtResource("1_24gqh") @@ -70,15 +31,14 @@ _movement = NodePath("Scripts/PlayerMovement") [node name="Scripts" type="Node" parent="."] -[node name="PlayerMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body", "rotate", "sprite")] +[node name="PlayerMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body", "rotate")] script = ExtResource("2_o7et6") body = NodePath("../..") -rotate = NodePath("../../PlayerRotated") -sprite = NodePath("../../AnimatedSprite3D") +rotate = NodePath("../../PlayerRotate") [node name="PlayerInteraction" type="Node" parent="Scripts" node_paths=PackedStringArray("interactableArea", "player")] script = ExtResource("3_24gqh") -interactableArea = NodePath("../../PlayerRotated/PlayerInteractableArea") +interactableArea = NodePath("../../PlayerRotate/PlayerInteractableArea") player = NodePath("../..") [node name="PlayerInput" type="Node" parent="Scripts" node_paths=PackedStringArray("interaction", "movement")] @@ -92,24 +52,23 @@ camera = NodePath("../../PlayerCamera") target = NodePath("../..") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.5, 0) -shape = SubResource("SphereShape3D_4pwj0") +shape = SubResource("CapsuleShape3D_rykwh") [node name="PlayerCamera" type="Camera3D" parent="."] +transform = Transform3D(1, -0.000461383, 0.000263726, 0.000138582, 0.705475, 0.708735, -0.00051305, -0.708735, 0.705475, 0.00619125, 4.26114, 4.36711) -[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0496178, 0, -0.00852585) -pixel_size = 1.0 -axis = 1 -double_sided = false -texture_filter = 0 -sprite_frames = SubResource("SpriteFrames_2rv2u") -animation = &"walk_south" +[node name="PlayerRotate" type="Node3D" parent="."] -[node name="PlayerRotated" type="Node3D" parent="."] +[node name="CapsuleMesh" type="MeshInstance3D" parent="PlayerRotate"] +mesh = SubResource("CapsuleMesh_etv1g") +skeleton = NodePath("../..") -[node name="PlayerInteractableArea" type="Area3D" parent="PlayerRotated"] +[node name="MeshInstance3D" type="MeshInstance3D" parent="PlayerRotate/CapsuleMesh"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.41166, 0.475431) +mesh = SubResource("BoxMesh_m44ds") -[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerRotated/PlayerInteractableArea"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8, 10) +[node name="PlayerInteractableArea" type="Area3D" parent="PlayerRotate"] + +[node name="InteractHitbox" type="CollisionShape3D" parent="PlayerRotate/PlayerInteractableArea"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0233459, 0, 0.795664) shape = SubResource("BoxShape3D_g13of") diff --git a/entity/player/PlayerCamera.gd b/entity/player/PlayerCamera.gd index ea1b320..1b583d0 100644 --- a/entity/player/PlayerCamera.gd +++ b/entity/player/PlayerCamera.gd @@ -6,28 +6,22 @@ const CAMERA_PIXEL_SCALE = 1.0 @export var camera:Camera3D = null @export var target:Node3D = null -@export var offset:Vector3 = Vector3(0, 0, 12) + +var angle = 0.0 func _process(delta: float) -> void: if !camera || !target: return + + # Follow target + # camera.global_transform.origin = target.global_transform.origin - # I tried a few things but this is most consistent for both backbuffer and - # framebuffer viewports. - var viewportHeight = get_viewport().get_visible_rect().size.y; - var unitScale = CAMERA_PIXEL_SCALE * CAMERA_PIXELS_PER_UNIT; + # # Spin around origin. + # var rotation_speed = 1 # Radians per second + # angle += rotation_speed * delta + # var radius = 3.0 + # var offset = Vector3(radius * sin(angle), 2.0, radius * cos(angle)) + # camera.global_transform.origin += offset - var z:float = ( - tan((deg_to_rad(180) - deg_to_rad(camera.fov)) / 2.0) * - (viewportHeight / 2.0) - ) / unitScale; - - var look = target.global_position; - var position = offset + look; - - camera.look_at_from_position( - Vector3(position.x, position.y + z, position.z), - look - ); - - pass + # # Look at target + # camera.look_at(target.global_transform.origin, Vector3.UP) diff --git a/map/TestMap.tscn b/map/TestMap.tscn index bd600f3..620b13b 100644 --- a/map/TestMap.tscn +++ b/map/TestMap.tscn @@ -11,8 +11,9 @@ script = ExtResource("1_6ms5s") [node name="TestMapBase" parent="." instance=ExtResource("1_ox0si")] [node name="Player" parent="." instance=ExtResource("2_0d2qr")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.04397, 1.9488, -16.5251) -facingDirection = 1 +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.5777, 1.74123, 0) [node name="NPC" parent="." instance=ExtResource("3_0vfw4")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.30029, 4.06806, 0.563562) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.3026, 1.9909, -2.12904) +walkSpeed = 48.0 +runSpeed = 64.0 diff --git a/project.godot b/project.godot index 9e41acc..f870435 100644 --- a/project.godot +++ b/project.godot @@ -35,10 +35,9 @@ gdscript/warnings/shadowed_variable=0 window/size/viewport_width=480 window/size/viewport_height=270 -window/size/window_width_override=960 -window/size/window_height_override=540 -window/stretch/mode="viewport" -window/stretch/scale_mode="integer" +window/size/window_width_override=1440 +window/size/window_height_override=810 +window/stretch/mode="canvas_items" [dotnet] diff --git a/singleton/Load.gd b/singleton/Load.gd index 2ef5527..900aabc 100644 --- a/singleton/Load.gd +++ b/singleton/Load.gd @@ -8,25 +8,25 @@ signal loadProgress(scenePath:String, loadId:int, progress:float) var watchingIds:Array[int] = [] func _process(delta: float) -> void: - var wIds = watchingIds.duplicate() - for watchId in wIds: - var status = ResourceLoader.load_threaded_get_status(watchId) - if status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED: - watchingIds.erase(watchId) - var resource = ResourceLoader.load_threaded_get(watchId) - loadEnd.emit(watchId, resource) - elif status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_FAILED: - watchingIds.erase(watchId) - loadError.emit(watchId, "Error loading resource.") - elif status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_INVALID_RESOURCE: - watchingIds.erase(watchId) - loadError.emit(watchId, "Invalid Resource.") - elif status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_IN_PROGRESS: - loadProgress.emit(watchId, 0.0) - pass + var wIds = watchingIds.duplicate() + for watchId in wIds: + var status = ResourceLoader.load_threaded_get_status(watchId) + if status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED: + watchingIds.erase(watchId) + var resource = ResourceLoader.load_threaded_get(watchId) + loadEnd.emit(watchId, resource) + elif status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_FAILED: + watchingIds.erase(watchId) + loadError.emit(watchId, "Error loading resource.") + elif status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_INVALID_RESOURCE: + watchingIds.erase(watchId) + loadError.emit(watchId, "Invalid Resource.") + elif status == ResourceLoader.ThreadLoadStatus.THREAD_LOAD_IN_PROGRESS: + loadProgress.emit(watchId, 0.0) + pass func load(scenePath:String) -> int: - var loadId = ResourceLoader.load_threaded_request(scenePath) - watchingIds.append(loadId) - loadStart.emit(scenePath, loadId) - return loadId \ No newline at end of file + var loadId = ResourceLoader.load_threaded_request(scenePath) + watchingIds.append(loadId) + loadStart.emit(scenePath, loadId) + return loadId \ No newline at end of file diff --git a/singleton/Scene.gd b/singleton/Scene.gd index 61d7196..260b89d 100644 --- a/singleton/Scene.gd +++ b/singleton/Scene.gd @@ -1,19 +1,19 @@ class_name SceneSingleton extends Node enum SceneType { - UNSET, - INITIAL, - OVERWORLD + UNSET, + INITIAL, + OVERWORLD } var currentScene:SceneType = SceneType.UNSET signal sceneChanged(newScene:SceneType) func _enter_tree() -> void: - currentScene = SceneType.UNSET + currentScene = SceneType.UNSET func setScene(newScene:SceneType) -> void: - if currentScene == newScene: - return - currentScene = newScene - sceneChanged.emit(currentScene) \ No newline at end of file + if currentScene == newScene: + return + currentScene = newScene + sceneChanged.emit(currentScene) \ No newline at end of file diff --git a/singleton/Transition.gd b/singleton/Transition.gd index caa9fd5..2968f70 100644 --- a/singleton/Transition.gd +++ b/singleton/Transition.gd @@ -1,9 +1,9 @@ class_name TransitionSingleton extends Control enum FadeType { - NONE, - FADE_IN, - FADE_OUT + NONE, + FADE_IN, + FADE_OUT } signal fadeOutStart @@ -18,64 +18,64 @@ var fadeTime:float = 0.0 var inFade = false func _enter_tree() -> void: - $Overlay.visible = false + $Overlay.visible = false func _process(delta: float) -> void: - if fadeType == FadeType.NONE: - return + if fadeType == FadeType.NONE: + return - fadeTime += delta - var t:float = fadeTime / fadeDuration + fadeTime += delta + var t:float = fadeTime / fadeDuration - # Get destination alpha type. - var destAlpha:float = 0.0 - var srcAlpha:float - if fadeType == FadeType.FADE_IN: - srcAlpha = 1.0 - destAlpha = 0.0 - elif fadeType == FadeType.FADE_OUT: - srcAlpha = 0.0 - destAlpha = 1.0 + # Get destination alpha type. + var destAlpha:float = 0.0 + var srcAlpha:float + if fadeType == FadeType.FADE_IN: + srcAlpha = 1.0 + destAlpha = 0.0 + elif fadeType == FadeType.FADE_OUT: + srcAlpha = 0.0 + destAlpha = 1.0 - # End? - if t >= 1.0: - fadeUpdate.emit(1.0) - var cFade = fadeType - fadeType = FadeType.NONE - $Overlay.color.a = destAlpha - inFade = false + # End? + if t >= 1.0: + fadeUpdate.emit(1.0) + var cFade = fadeType + fadeType = FadeType.NONE + $Overlay.color.a = destAlpha + inFade = false - if cFade == FadeType.FADE_OUT: - fadeOutEnd.emit() - elif cFade == FadeType.FADE_IN: - fadeInEnd.emit() - - return + if cFade == FadeType.FADE_OUT: + fadeOutEnd.emit() + elif cFade == FadeType.FADE_IN: + fadeInEnd.emit() + + return - # TODO: Use curves - $Overlay.color.a = srcAlpha + (destAlpha - srcAlpha) * t - fadeUpdate.emit(t) - pass + # TODO: Use curves + $Overlay.color.a = srcAlpha + (destAlpha - srcAlpha) * t + fadeUpdate.emit(t) + pass func fade( - fade:FadeType = FadeType.FADE_IN, - duration:float = 0.4, - color:Color = Color(0, 0, 0, 1), + fade:FadeType = FadeType.FADE_IN, + duration:float = 0.4, + color:Color = Color(0, 0, 0, 1), ): - if inFade: - push_error("Transition: Cannot start a new fade while another is in progress.") - return + if inFade: + push_error("Transition: Cannot start a new fade while another is in progress.") + return - $Overlay.visible = true - $Overlay.color = color - fadeDuration = duration - fadeTime = 0 - fadeType = fade - inFade = true + $Overlay.visible = true + $Overlay.color = color + fadeDuration = duration + fadeTime = 0 + fadeType = fade + inFade = true - if fade == FadeType.FADE_IN: - fadeInStart.emit() - $Overlay.color.a = 0 - elif fade == FadeType.FADE_OUT: - fadeOutStart.emit() - $Overlay.color.a = 1 \ No newline at end of file + if fade == FadeType.FADE_IN: + fadeInStart.emit() + $Overlay.color.a = 0 + elif fade == FadeType.FADE_OUT: + fadeOutStart.emit() + $Overlay.color.a = 1 \ No newline at end of file diff --git a/singleton/UI.gd b/singleton/UI.gd index a567355..1c1acaa 100644 --- a/singleton/UI.gd +++ b/singleton/UI.gd @@ -2,4 +2,3 @@ class_name UISingleton extends Control @export var TEXTBOX: VNTextbox @export var PAUSE: PauseMenu -@onready var MADTALK:Node = $VNTextbox/MadTalk;