Added Basic Package Delivery

This commit is contained in:
root 2024-10-05 13:00:30 -07:00
parent f46fc5612f
commit b0bce2e6a9
14 changed files with 214 additions and 80 deletions

View file

@ -2,52 +2,29 @@
[ext_resource type="Script" path="res://scripts/contract.gd" id="1_esxg1"]
[ext_resource type="Texture2D" uid="uid://bnqe06njx2agc" path="res://sprites/contract.png" id="1_jwp1o"]
[ext_resource type="Theme" uid="uid://d0ir0t347wqv7" path="res://etc/default_theme.tres" id="1_m2twt"]
[ext_resource type="PackedScene" uid="uid://dpwqurhly8osd" path="res://scenes/interactible_manager.tscn" id="3_khqae"]
[ext_resource type="PackedScene" uid="uid://sk2uc8hcxhcj" path="res://scenes/physical_dialogue.tscn" id="4_oks7g"]
[sub_resource type="CircleShape2D" id="CircleShape2D_mxuxo"]
radius = 217.993
radius = 116.44
[node name="Contract" type="Area2D" node_paths=PackedStringArray("DestinationLabel", "InteractibleManager")]
[node name="Contract" type="Area2D" node_paths=PackedStringArray("InteractibleManager")]
script = ExtResource("1_esxg1")
Destination = "20th Burnaby"
DestinationLabel = NodePath("Control/LabelPanel/Label")
InteractibleManager = NodePath("InteractibleManager")
[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_top = -308.485
offset_right = 40.0
offset_bottom = -268.485
[node name="LabelPanel" type="PanelContainer" parent="Control"]
z_index = 10
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_m2twt")
[node name="Label" type="Label" parent="Control/LabelPanel"]
layout_mode = 2
theme = ExtResource("1_m2twt")
text = "20th Burnaby"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
metadata/_edit_lock_ = true
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(0.5, 0.5)
texture = ExtResource("1_jwp1o")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_mxuxo")
[node name="InteractibleManager" parent="." node_paths=PackedStringArray("ItemShown") instance=ExtResource("3_khqae")]
ItemShown = NodePath("../Control/LabelPanel")
ItemShown = NodePath("../Dialogue")
[node name="Dialogue" parent="." instance=ExtResource("4_oks7g")]
offset_top = -202.455
offset_bottom = -162.455
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]
[connection signal="body_exited" from="." to="InteractibleManager" method="_on_body_exited"]

View file

@ -1,8 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://cpxco37ip15ev"]
[gd_scene load_steps=6 format=3 uid="uid://cpxco37ip15ev"]
[ext_resource type="Texture2D" uid="uid://ci3yxj63e5u8f" path="res://sprites/contractgiver.png" id="1_awtl7"]
[ext_resource type="PackedScene" uid="uid://cn41xqc3lwaxy" path="res://scenes/contract.tscn" id="2_kh0dp"]
[ext_resource type="Theme" uid="uid://d0ir0t347wqv7" path="res://etc/default_theme.tres" id="2_v5tdy"]
[ext_resource type="PackedScene" uid="uid://sk2uc8hcxhcj" path="res://scenes/physical_dialogue.tscn" id="3_dlmpa"]
[ext_resource type="PackedScene" uid="uid://dpwqurhly8osd" path="res://scenes/interactible_manager.tscn" id="4_1m1bm"]
[sub_resource type="CircleShape2D" id="CircleShape2D_put5l"]
@ -17,31 +16,6 @@ size = Vector2(409, 181)
texture = ExtResource("1_awtl7")
metadata/_edit_lock_ = true
[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_top = -256.34
offset_bottom = -256.34
[node name="LabelPanel" type="PanelContainer" parent="Control"]
z_index = 10
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("2_v5tdy")
[node name="Label" type="Label" parent="Control/LabelPanel"]
layout_mode = 2
theme = ExtResource("2_v5tdy")
text = "HeLLO DEAR EMPLOYEE"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
metadata/_edit_lock_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, 150)
shape = SubResource("CircleShape2D_put5l")
@ -54,18 +28,11 @@ position = Vector2(7.5, 15.5)
shape = SubResource("RectangleShape2D_sdg4f")
metadata/_edit_lock_ = true
[node name="Contract" parent="." instance=ExtResource("2_kh0dp")]
position = Vector2(-498, 747)
Destination = "1263 30th Ave SE Courier Way"
[node name="Contract2" parent="." instance=ExtResource("2_kh0dp")]
position = Vector2(113, 753)
[node name="Contract3" parent="." instance=ExtResource("2_kh0dp")]
position = Vector2(710, 753)
[node name="InteractibleManager" parent="." node_paths=PackedStringArray("ItemShown") instance=ExtResource("4_1m1bm")]
ItemShown = NodePath("../Control/LabelPanel")
ItemShown = NodePath("../Dialogue")
[node name="Dialogue" parent="." instance=ExtResource("3_dlmpa")]
DefaultText = "Hello Dear Employee"
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]
[connection signal="body_exited" from="." to="InteractibleManager" method="_on_body_exited"]

28
scenes/delivery_spot.tscn Normal file
View file

@ -0,0 +1,28 @@
[gd_scene load_steps=6 format=3 uid="uid://bm1ptkidbwi36"]
[ext_resource type="Script" path="res://scripts/delivery_spot.gd" id="1_3e4vt"]
[ext_resource type="Texture2D" uid="uid://krvl11xhrefj" path="res://sprites/deliveryspot.png" id="1_8xm5p"]
[ext_resource type="PackedScene" uid="uid://dpwqurhly8osd" path="res://scenes/interactible_manager.tscn" id="2_o3i7n"]
[ext_resource type="PackedScene" uid="uid://sk2uc8hcxhcj" path="res://scenes/physical_dialogue.tscn" id="3_qfb8a"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_liqw2"]
size = Vector2(156, 160)
[node name="DeliverySpot" type="Area2D"]
script = ExtResource("1_3e4vt")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-7, 158)
shape = SubResource("RectangleShape2D_liqw2")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_8xm5p")
[node name="InteractibleManager" parent="." node_paths=PackedStringArray("ItemShown") instance=ExtResource("2_o3i7n")]
ItemShown = NodePath("../Dialogue")
[node name="Dialogue" parent="." instance=ExtResource("3_qfb8a")]
DefaultText = "Default Address"
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]
[connection signal="body_exited" from="." to="InteractibleManager" method="_on_body_exited"]

View file

@ -0,0 +1,31 @@
[gd_scene load_steps=3 format=3 uid="uid://sk2uc8hcxhcj"]
[ext_resource type="Script" path="res://scripts/physical_dialogue.gd" id="1_3l55m"]
[ext_resource type="Theme" uid="uid://d0ir0t347wqv7" path="res://etc/default_theme.tres" id="1_s71uu"]
[node name="Dialogue" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_top = -308.485
offset_right = 40.0
offset_bottom = -268.485
script = ExtResource("1_3l55m")
[node name="LabelPanel" type="PanelContainer" parent="."]
z_index = 10
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_s71uu")
[node name="Label" type="Label" parent="LabelPanel"]
layout_mode = 2
theme = ExtResource("1_s71uu")
text = "Lorem Ipsum Dolor"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
metadata/_edit_lock_ = true

View file

@ -1,16 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://bjy3gfpx6h1w5"]
[gd_scene load_steps=5 format=3 uid="uid://bjy3gfpx6h1w5"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_a7huw"]
[ext_resource type="Texture2D" uid="uid://dnxdkwa1krlv" path="res://sprites/ant.png" id="2_5v6iy"]
[ext_resource type="Texture2D" uid="uid://duouoluo2hyru" path="res://sprites/package.png" id="3_peuqy"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_f3qr4"]
radius = 25.0
height = 100.0
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Sprite") groups=["player"]]
[node name="Player" type="CharacterBody2D" groups=["player"]]
z_index = 1
script = ExtResource("1_a7huw")
Sprite = NodePath("Sprite2D")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_5v6iy")
@ -22,3 +22,8 @@ shape = SubResource("CapsuleShape2D_f3qr4")
[node name="Camera2D" type="Camera2D" parent="."]
zoom = Vector2(0.3, 0.3)
[node name="PackageSprite" type="Sprite2D" parent="."]
visible = false
scale = Vector2(0.134766, 0.134766)
texture = ExtResource("3_peuqy")

View file

@ -1,9 +1,11 @@
[gd_scene load_steps=7 format=4 uid="uid://72e8cy3uuy8m"]
[gd_scene load_steps=9 format=4 uid="uid://72e8cy3uuy8m"]
[ext_resource type="Texture2D" uid="uid://tqbjd6io6qfa" path="res://sprites/ground.jpg" id="1_deahv"]
[ext_resource type="PackedScene" uid="uid://bjy3gfpx6h1w5" path="res://scenes/player.tscn" id="2_jm6jq"]
[ext_resource type="Texture2D" uid="uid://dih2wjgfl4do" path="res://sprites/tiles/groundtile.jpg" id="3_3e26l"]
[ext_resource type="PackedScene" uid="uid://cpxco37ip15ev" path="res://scenes/contract_giver.tscn" id="4_0h7cx"]
[ext_resource type="PackedScene" uid="uid://cn41xqc3lwaxy" path="res://scenes/contract.tscn" id="5_q4ykf"]
[ext_resource type="PackedScene" uid="uid://bm1ptkidbwi36" path="res://scenes/delivery_spot.tscn" id="6_i8g18"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_knvup"]
texture = ExtResource("3_3e26l")
@ -35,3 +37,19 @@ tile_set = SubResource("TileSet_g3b4o")
[node name="ContractGiver" parent="." instance=ExtResource("4_0h7cx")]
position = Vector2(779, -1420)
[node name="Contract" parent="ContractGiver" node_paths=PackedStringArray("Destination") instance=ExtResource("5_q4ykf")]
position = Vector2(6, 779)
Destination = NodePath("../../DeliverySpot")
[node name="Contract2" parent="ContractGiver" node_paths=PackedStringArray("Destination") instance=ExtResource("5_q4ykf")]
position = Vector2(-491, 791)
Destination = NodePath("../../DeliverySpot")
[node name="Contract3" parent="ContractGiver" node_paths=PackedStringArray("Destination") instance=ExtResource("5_q4ykf")]
position = Vector2(501, 767)
Destination = NodePath("../../DeliverySpot")
[node name="DeliverySpot" parent="." instance=ExtResource("6_i8g18")]
position = Vector2(-1438, -806)
Address = "1234 Fuck You Lane"

View file

@ -1,7 +1,7 @@
extends Area2D
@export var Destination : String
@export var DestinationLabel : Label
@export var Destination : Node2D
@onready var DestinationDialogue : Control = $Dialogue
@export var InteractibleManager : Node
@ -11,10 +11,12 @@ var Player : Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
DestinationLabel.text = Destination
DestinationDialogue.DialogueLabel.text = Destination.Address
Player = get_tree().get_first_node_in_group("player")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if Input.is_action_pressed("interact") and InteractibleManager.selected:
if Input.is_action_pressed("interact") and InteractibleManager.selected and not Player.ActiveContract:
Player.ActiveContract = Destination
queue_free()

19
scripts/delivery_spot.gd Normal file
View file

@ -0,0 +1,19 @@
extends Area2D
@export var Address : String
@onready var Dialogue : Control = $Dialogue
@onready var InteractibleManager = $InteractibleManager
var Player : Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Dialogue.DialogueLabel.text = Address
Player = get_tree().get_first_node_in_group("player")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if Input.is_action_pressed("interact") and InteractibleManager.selected and Player.ActiveContract == self:
Player.ActiveContract = null

View file

@ -0,0 +1,13 @@
extends Control
@onready var DialogueLabel : Label = $LabelPanel/Label
@export var DefaultText : String
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
DialogueLabel.text = DefaultText
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View file

@ -3,11 +3,12 @@ extends CharacterBody2D
@export var Speed = 2500
@export var FrictionMult = 5
@export var Sprite : Sprite2D
@onready var Sprite : Sprite2D = $Sprite2D
var SpriteTurningSpeed = 5
var ActiveContract : Node2D
@onready var PackageSprite = $PackageSprite
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@ -37,4 +38,9 @@ func _physics_process(delta: float) -> void:
if velocity.length() > 0.1:
Sprite.rotation = rotate_toward(Sprite.rotation,velocity.angle(),delta*SpriteTurningSpeed)
if ActiveContract:
PackageSprite.show()
else:
PackageSprite.hide()
move_and_slide()

BIN
sprites/deliveryspot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://krvl11xhrefj"
path="res://.godot/imported/deliveryspot.png-c24787e28f33d37a43c44160092129c7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/deliveryspot.png"
dest_files=["res://.godot/imported/deliveryspot.png-c24787e28f33d37a43c44160092129c7.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

BIN
sprites/package.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://duouoluo2hyru"
path="res://.godot/imported/package.png-1861a07289aca9c550384a249902db4f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/package.png"
dest_files=["res://.godot/imported/package.png-1861a07289aca9c550384a249902db4f.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