From 5cd8b8a04bf1950e61fae240c06bdc2e8e0662e0 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 19 Aug 2025 16:56:44 -0500 Subject: [PATCH] idk getting back to it --- entities/npc/NPC.gd | 1 + entities/npc/NPC.gd.uid | 1 + entities/npc/NPC.tscn | 91 +++++++++++++++++ entities/npc/NPCTest.gd | 5 + entities/npc/NPCTest.gd.uid | 1 + entities/player/Player.png | Bin 0 -> 237 bytes entities/player/Player.png.import | 35 +++++++ entities/player/Player.png.pxo | Bin 0 -> 881 bytes entities/player/Player.tscn | 96 ++++++++++++++---- entities/player/PlayerCamera.gd | 7 +- entities/player/PlayerMaterial.tres | 13 +++ entities/player/PlayerMovement.gd | 134 +++++++++++++++++++------ maps/TestMap.tscn | 6 +- maps/TestMapBase.tscn | 4 +- materials/EntityMaterial.tres | 9 -- materials/WorldMaterial.tres | 1 + materials/WorldMaterialShader.gdshader | 5 +- 17 files changed, 342 insertions(+), 67 deletions(-) create mode 100644 entities/npc/NPC.gd create mode 100644 entities/npc/NPC.gd.uid create mode 100644 entities/npc/NPC.tscn create mode 100644 entities/npc/NPCTest.gd create mode 100644 entities/npc/NPCTest.gd.uid create mode 100644 entities/player/Player.png create mode 100644 entities/player/Player.png.import create mode 100644 entities/player/Player.png.pxo create mode 100644 entities/player/PlayerMaterial.tres delete mode 100644 materials/EntityMaterial.tres diff --git a/entities/npc/NPC.gd b/entities/npc/NPC.gd new file mode 100644 index 0000000..9898402 --- /dev/null +++ b/entities/npc/NPC.gd @@ -0,0 +1 @@ +class_name NPC extends CharacterBody3D diff --git a/entities/npc/NPC.gd.uid b/entities/npc/NPC.gd.uid new file mode 100644 index 0000000..813df0a --- /dev/null +++ b/entities/npc/NPC.gd.uid @@ -0,0 +1 @@ +uid://crw7ls7t8cwct diff --git a/entities/npc/NPC.tscn b/entities/npc/NPC.tscn new file mode 100644 index 0000000..924f803 --- /dev/null +++ b/entities/npc/NPC.tscn @@ -0,0 +1,91 @@ +[gd_scene load_steps=12 format=3 uid="uid://kabs7mopalmo"] + +[ext_resource type="Script" uid="uid://crw7ls7t8cwct" path="res://entities/npc/NPC.gd" id="1_00k55"] +[ext_resource type="Script" uid="uid://cmwovncvo1n5o" path="res://entities/npc/NPCTest.gd" id="2_1seh5"] +[ext_resource type="Script" uid="uid://b00rxpveu3v4m" path="res://InteractableArea.gd" id="2_x8luf"] +[ext_resource type="Texture2D" uid="uid://xx3qp5xh7tgu" path="res://entities/player/Player.png" id="4_x8luf"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_1seh5"] +size = Vector3(16, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rl6fg"] +atlas = ExtResource("4_x8luf") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_q57vx"] +atlas = ExtResource("4_x8luf") +region = Rect2(48, 0, 16, 16) + +[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 + +[node name="NPC" type="CharacterBody3D"] +script = ExtResource("1_00k55") + +[node name="Scripts" type="Node" parent="."] + +[node name="NPCTest" type="Node" parent="Scripts"] +script = ExtResource("2_1seh5") + +[node name="InteractableArea" type="Area3D" parent="."] +script = ExtResource("2_x8luf") +metadata/_custom_type_script = "uid://b00rxpveu3v4m" + +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableArea"] +shape = SubResource("BoxShape3D_1seh5") + +[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."] +pixel_size = 1.0 +billboard = 1 +double_sided = false +texture_filter = 0 +sprite_frames = SubResource("SpriteFrames_1seh5") +animation = &"walk_west" + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("SphereShape3D_x8luf") + +[connection signal="interactEvent" from="InteractableArea" to="Scripts/NPCTest" method="onInteract"] diff --git a/entities/npc/NPCTest.gd b/entities/npc/NPCTest.gd new file mode 100644 index 0000000..b7f9fc2 --- /dev/null +++ b/entities/npc/NPCTest.gd @@ -0,0 +1,5 @@ +class_name NPCTest extends Node + +func onInteract(playerEntity: Player) -> void: + print("Player has interacted with the NPC.") + UI.TEXTBOX.setText("You have interacted with the NPC.") diff --git a/entities/npc/NPCTest.gd.uid b/entities/npc/NPCTest.gd.uid new file mode 100644 index 0000000..6d127e0 --- /dev/null +++ b/entities/npc/NPCTest.gd.uid @@ -0,0 +1 @@ +uid://cmwovncvo1n5o diff --git a/entities/player/Player.png b/entities/player/Player.png new file mode 100644 index 0000000000000000000000000000000000000000..60ee93662b7e7c125af9d953299201116738b9ea GIT binary patch literal 237 zcmVPx#r%6OXR9J=Wm(dQu5DZ0K+5i8ty-3itbi`=vzSt_Ky&9Q;;}wKBgt%FrOBh1n zc>o#{rg*P~?nT&TVJ6q5w#)=00000NkvXXu0mjfXzygN literal 0 HcmV?d00001 diff --git a/entities/player/Player.png.import b/entities/player/Player.png.import new file mode 100644 index 0000000..416b062 --- /dev/null +++ b/entities/player/Player.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://xx3qp5xh7tgu" +path.s3tc="res://.godot/imported/Player.png-e32651025a39607688584ad92d58078b.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://entities/player/Player.png" +dest_files=["res://.godot/imported/Player.png-e32651025a39607688584ad92d58078b.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/entities/player/Player.png.pxo b/entities/player/Player.png.pxo new file mode 100644 index 0000000000000000000000000000000000000000..1331d84f84d1b57c4f716b13fdefb51f08db5bb5 GIT binary patch literal 881 zcmWIWW@Zs#VBp|j$S4zzX6k;%mCwk)@Q#Urfs=uOAtkXSQ7@}FKd&|DVqUWW&!4HM z{Aara242s5B>io}_my2S25U_{7O9k6SoPno{gBlb&uYhMZ>{gg?l^F7>pu^j@1truo@9DdP9C-kfw~nku>~S1Wqz$$f#X=QDj_SMn!g}uW14c}DQR(Ew7H2QvYeEK~nFLBF%DSjQJ ziz{9RyY60<_E*^Kd)CE?(+s9ZGA-P0uKS<8AnAM(!>0#PU24yhbjnpKasuWac|U=7 z&L$J@>)!GPN~tT2zpvc0adDT6k7Jj#jZbH#-Q-D2w)-c`PR(EXPI~9ds#M>g-oMXS|IJ;u@IhwPvTKurx9cdl zwa)r$xbMyOOLxC=2cX0Xx2pf#a$syQ2rw{61F6j1#Prm7P~7OJ6(#1T7V8`8=Ok99 z7R4LBy&A~XV8FwC;okpCpWR*3gCDo)Ol4y`RP*xN;{&)N~w$ddj-`3||H_W;4dHUzm)Ai%)ri%ahxAxzEjUV3a*RQ|7ZEL() z^v^}XyY?HdNFJ%Z;dsNo;`aT|VzW)^m{Hx^`=03%GtiyDgv6kX!@Ze#DVfQs#qm&g zCo?bvcryZ19qzOUGze@Wh(=18=-SW&3!)rEP6N6JPtc(ogzgK3L2f{IVlxQMPXXSn SY#>d{KzI>IcLB9AFaQ7-zDpng literal 0 HcmV?d00001 diff --git a/entities/player/Player.tscn b/entities/player/Player.tscn index 8b0a76b..1ff5fb4 100644 --- a/entities/player/Player.tscn +++ b/entities/player/Player.tscn @@ -1,31 +1,83 @@ -[gd_scene load_steps=10 format=3 uid="uid://2ch34sio36nv"] +[gd_scene load_steps=14 format=3 uid="uid://2ch34sio36nv"] [ext_resource type="Script" uid="uid://ylmy3nvpirgr" path="res://entities/player/Player.gd" id="1_24gqh"] [ext_resource type="Script" uid="uid://bwxdv3kxrs4oj" path="res://entities/player/PlayerMovement.gd" id="2_o7et6"] [ext_resource type="Script" uid="uid://b3nty7pvbo58d" path="res://entities/player/PlayerInteraction.gd" id="3_24gqh"] [ext_resource type="Script" uid="uid://bdv1fj1pwknrs" path="res://entities/player/PlayerInput.gd" id="4_yjynp"] [ext_resource type="Script" uid="uid://bdjgvyiacbg28" path="res://entities/player/PlayerCamera.gd" id="5_g3lhm"] -[ext_resource type="Material" uid="uid://bx0778wr1ge00" path="res://materials/EntityMaterial.tres" id="6_4pwj0"] +[ext_resource type="Texture2D" uid="uid://xx3qp5xh7tgu" path="res://entities/player/Player.png" id="7_fmb3c"] -[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2m2ha"] +[sub_resource type="SphereShape3D" id="SphereShape3D_4pwj0"] +radius = 8.5 -[sub_resource type="QuadMesh" id="QuadMesh_fmb3c"] +[sub_resource type="AtlasTexture" id="AtlasTexture_rl6fg"] +atlas = ExtResource("7_fmb3c") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_q57vx"] +atlas = ExtResource("7_fmb3c") +region = Rect2(48, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ak4un"] +atlas = ExtResource("7_fmb3c") +region = Rect2(0, 0, 16, 16) + +[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="BoxShape3D" id="BoxShape3D_g13of"] -size = Vector3(0.705444, 0.680542, 1.17688) +size = Vector3(10, 16, 8) [node name="Player" type="CharacterBody3D"] script = ExtResource("1_24gqh") [node name="Scripts" type="Node" parent="."] -[node name="PlayerMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("player")] +[node name="PlayerMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("player", "rotated", "sprite")] script = ExtResource("2_o7et6") player = NodePath("../..") +rotated = NodePath("../../PlayerRotated") +sprite = NodePath("../../AnimatedSprite3D") [node name="PlayerInteraction" type="Node" parent="Scripts" node_paths=PackedStringArray("interactableArea", "player")] script = ExtResource("3_24gqh") -interactableArea = NodePath("../../PlayerInteractableArea") +interactableArea = NodePath("../../PlayerRotated/PlayerInteractableArea") player = NodePath("../..") [node name="PlayerInput" type="Node" parent="Scripts" node_paths=PackedStringArray("interaction", "movement")] @@ -39,18 +91,22 @@ camera = NodePath("../../PlayerCamera") target = NodePath("../..") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] -shape = SubResource("CapsuleShape3D_2m2ha") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) -mesh = SubResource("QuadMesh_fmb3c") -surface_material_override/0 = ExtResource("6_4pwj0") - -[node name="PlayerInteractableArea" type="Area3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.185831, 0.817421) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerInteractableArea"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0123757, 0.0497631, 0.0865124) -shape = SubResource("BoxShape3D_g13of") +shape = SubResource("SphereShape3D_4pwj0") [node name="PlayerCamera" type="Camera3D" parent="."] + +[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."] +pixel_size = 1.0 +billboard = 1 +double_sided = false +texture_filter = 0 +sprite_frames = SubResource("SpriteFrames_2rv2u") +animation = &"walk_south" + +[node name="PlayerRotated" type="Node3D" parent="."] + +[node name="PlayerInteractableArea" type="Area3D" parent="PlayerRotated"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerRotated/PlayerInteractableArea"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10) +shape = SubResource("BoxShape3D_g13of") diff --git a/entities/player/PlayerCamera.gd b/entities/player/PlayerCamera.gd index 019b5cd..a0e2c60 100644 --- a/entities/player/PlayerCamera.gd +++ b/entities/player/PlayerCamera.gd @@ -1,10 +1,11 @@ class_name PlayerCamera extends Node -const CAMERA_PIXELS_PER_UNIT = 32.0 -const CAMERA_PIXEL_SCALE = 1.0 +const CAMERA_PIXELS_PER_UNIT = 1.0 +const CAMERA_PIXEL_SCALE = 2.0 @export var camera:Camera3D = null @export var target:Node3D = null +@export var offset:Vector3 = Vector3(0, 0, 16) func _process(delta: float) -> void: # I tried a few things but this is most consistent for both backbuffer and @@ -18,7 +19,7 @@ func _process(delta: float) -> void: ) / unitScale; var look = target.global_position; - var position = Vector3(0, 0, 2) + look; + var position = offset + look; camera.look_at_from_position( Vector3(position.x, position.y + z, position.z), diff --git a/entities/player/PlayerMaterial.tres b/entities/player/PlayerMaterial.tres new file mode 100644 index 0000000..9223528 --- /dev/null +++ b/entities/player/PlayerMaterial.tres @@ -0,0 +1,13 @@ +[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://cv8q4cbjyfauh"] + +[ext_resource type="Shader" uid="uid://b3vi5kwotike5" path="res://materials/EntityMaterialShader.gdshader" id="1_gsq3s"] +[ext_resource type="Texture2D" uid="uid://xx3qp5xh7tgu" path="res://entities/player/Player.png" id="2_awgof"] + +[resource] +render_priority = 0 +shader = ExtResource("1_gsq3s") +shader_parameter/text = ExtResource("2_awgof") +shader_parameter/tileColumnCount = 4 +shader_parameter/tileRowCount = 1 +shader_parameter/tile = 0 +shader_parameter/color = Color(1, 1, 1, 1) diff --git a/entities/player/PlayerMovement.gd b/entities/player/PlayerMovement.gd index 85a0df7..029f555 100644 --- a/entities/player/PlayerMovement.gd +++ b/entities/player/PlayerMovement.gd @@ -1,47 +1,121 @@ class_name PlayerMovement extends Node -const TURN_SPEED = 30.0 -const SPEED = 8.0 +const SPEED = 64.0 +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" +}; @export var player:CharacterBody3D +@export var rotated:Node3D +@export var sprite:AnimatedSprite3D + +var facingDir:FacingDirection = FacingDirection.SOUTH var inputDir:Vector2 = Vector2.ZERO +func _enter_tree() -> void: + if !sprite: + return + for dir in FacingDirWalkAnimations: + if sprite.animation != FacingDirWalkAnimations[dir]: + continue + facingDir = dir + break + func canMove() -> bool: if PAUSE.isMovementPaused(): return false return true +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 + + sprite.animation = FacingDirWalkAnimations[facingDir] + +func applyGravity() -> void: + if !player.is_on_floor(): + player.velocity += PHYSICS.GRAVITY * get_process_delta_time() + +func applyMovement() -> void: + if !canMove(): + return + + + # Use camera orientation for movement direction + var cam_basis = get_viewport().get_camera_3d().global_transform.basis + # Forward and right vectors, ignore vertical component + + var forward = -cam_basis.z + forward.y = 0 + forward = forward.normalized() + var right = cam_basis.x + right.y = 0 + right = right.normalized() + + var directionAdjusted = ( + forward * inputDir.y + right * inputDir.x + ).normalized() + if directionAdjusted.length() <= 0.01: + return + + if rotated: + var targetRot = atan2(directionAdjusted.x, directionAdjusted.z) + rotated.rotation.y = targetRot + + player.velocity.x = directionAdjusted.x * SPEED + player.velocity.z = directionAdjusted.z * SPEED + +func applyFriction(delta:float) -> void: + player.velocity.x *= delta * FRICTION + player.velocity.z *= delta * FRICTION + func _physics_process(delta:float) -> void: + if !player: + return + var cameraCurrent = get_viewport().get_camera_3d() if !cameraCurrent: return - - # Player movement - var directionAdjusted = Vector3.ZERO - if canMove(): - # Use camera orientation for movement direction - var cam_basis = cameraCurrent.global_transform.basis - # Forward and right vectors, ignore vertical component - var forward = -cam_basis.z - forward.y = 0 - forward = forward.normalized() - var right = cam_basis.x - right.y = 0 - right = right.normalized() - directionAdjusted = (forward * inputDir.y + right * inputDir.x).normalized() - - # Rotate player to face movement direction if moving - if directionAdjusted.length() > 0.01: - var targetRot = atan2(directionAdjusted.x, directionAdjusted.z) - player.rotation.y = lerp_angle( - player.rotation.y, targetRot, TURN_SPEED * delta - ) - # Apply gravity if not on floor - if !player.is_on_floor(): - player.velocity += PHYSICS.GRAVITY * delta - - # Set velocity and move - player.velocity.x = directionAdjusted.x * SPEED - player.velocity.z = directionAdjusted.z * SPEED + applyGravity() + applyFriction(delta) + applyMovement() + applyFacingDir() player.move_and_slide() diff --git a/maps/TestMap.tscn b/maps/TestMap.tscn index 7c3d562..0b378d6 100644 --- a/maps/TestMap.tscn +++ b/maps/TestMap.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://d0ywgijpuqy0r"] +[gd_scene load_steps=4 format=3 uid="uid://d0ywgijpuqy0r"] [ext_resource type="PackedScene" uid="uid://cluuhtfjeodwb" path="res://maps/TestMapBase.tscn" id="1_ox0si"] [ext_resource type="PackedScene" uid="uid://2ch34sio36nv" path="res://entities/player/Player.tscn" id="2_0d2qr"] +[ext_resource type="PackedScene" uid="uid://kabs7mopalmo" path="res://entities/npc/NPC.tscn" id="3_0vfw4"] [node name="TestMap" type="Node3D"] @@ -9,3 +10,6 @@ [node name="Player" parent="." instance=ExtResource("2_0d2qr")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.59, 0) + +[node name="NPC" parent="." instance=ExtResource("3_0vfw4")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.33181, 0.554601, 0.508184) diff --git a/maps/TestMapBase.tscn b/maps/TestMapBase.tscn index d8064fb..bfc63cd 100644 --- a/maps/TestMapBase.tscn +++ b/maps/TestMapBase.tscn @@ -3,10 +3,10 @@ [ext_resource type="Material" uid="uid://chuogedj81c5" path="res://materials/WorldMaterial.tres" id="1_x4ibw"] [sub_resource type="PlaneMesh" id="PlaneMesh_owt5q"] -size = Vector2(10, 10) +size = Vector2(200, 200) [sub_resource type="BoxShape3D" id="BoxShape3D_x4ibw"] -size = Vector3(10, 0.1, 10) +size = Vector3(200, 0.1, 200) [node name="TestMapBase" type="Node3D"] diff --git a/materials/EntityMaterial.tres b/materials/EntityMaterial.tres deleted file mode 100644 index 5cdf0b2..0000000 --- a/materials/EntityMaterial.tres +++ /dev/null @@ -1,9 +0,0 @@ -[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://bx0778wr1ge00"] - -[ext_resource type="Shader" uid="uid://be6ueh411xro5" path="res://materials/WorldMaterialShader.gdshader" id="1_h67lk"] -[ext_resource type="Texture2D" uid="uid://cu1hvpqmqn31n" path="res://icon.svg" id="2_7766c"] - -[resource] -render_priority = 0 -shader = ExtResource("1_h67lk") -shader_parameter/text = ExtResource("2_7766c") diff --git a/materials/WorldMaterial.tres b/materials/WorldMaterial.tres index e6b7b37..a4202da 100644 --- a/materials/WorldMaterial.tres +++ b/materials/WorldMaterial.tres @@ -7,3 +7,4 @@ render_priority = 0 shader = ExtResource("1_76gxt") shader_parameter/text = ExtResource("2_7os1f") +shader_parameter/color = Color(1, 1, 1, 1) diff --git a/materials/WorldMaterialShader.gdshader b/materials/WorldMaterialShader.gdshader index 61d06e5..3c1d36b 100644 --- a/materials/WorldMaterialShader.gdshader +++ b/materials/WorldMaterialShader.gdshader @@ -2,6 +2,7 @@ shader_type spatial; render_mode unshaded; uniform sampler2D text; +uniform vec4 color: source_color = vec4(1.0, 1.0, 1.0, 1.0); //void vertex() { // @@ -9,6 +10,6 @@ uniform sampler2D text; void fragment() { vec4 tex_color = texture(text, UV); - ALBEDO = tex_color.rgb; - ALPHA = tex_color.a; + ALBEDO = tex_color.rgb * color.rgb; + ALPHA = tex_color.a * color.a; } \ No newline at end of file