Added basic map

This commit is contained in:
root 2024-10-05 18:03:28 -07:00
parent 24338ec2b5
commit f6c2532ae7
13 changed files with 343 additions and 47 deletions

View file

@ -22,11 +22,12 @@ window/stretch/aspect="expand"
[editor_plugins]
enabled=PackedStringArray("res://addons/timchi_maze_generation/plugin.cfg")
enabled=PackedStringArray()
[global_group]
player=""
"delivery spot"="valid for spawning in contracts"
[gui]

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://cpxco37ip15ev"]
[gd_scene load_steps=8 format=3 uid="uid://cpxco37ip15ev"]
[ext_resource type="Texture2D" uid="uid://ci3yxj63e5u8f" path="res://sprites/contractgiver.png" id="1_awtl7"]
[ext_resource type="Script" path="res://scripts/sign.gd" id="1_e2wbr"]
[ext_resource type="Script" path="res://scripts/contract_giver.gd" id="1_e2wbr"]
[ext_resource type="PackedScene" uid="uid://cn41xqc3lwaxy" path="res://scenes/contract.tscn" id="2_8dusb"]
[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"]
@ -11,10 +12,10 @@ radius = 389.155
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sdg4f"]
size = Vector2(409, 181)
[node name="ContractGiver" type="Area2D" node_paths=PackedStringArray("Dialogue")]
[node name="ContractGiver" type="Area2D"]
script = ExtResource("1_e2wbr")
text = "Hello Dear Employee"
Dialogue = NodePath("Dialogue")
ContractScene = ExtResource("2_8dusb")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_awtl7")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://bm1ptkidbwi36"]
[gd_scene load_steps=7 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"]
@ -8,7 +8,10 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_liqw2"]
size = Vector2(156, 160)
[node name="DeliverySpot" type="Area2D"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ed5ba"]
radius = 790.253
[node name="DeliverySpot" type="Area2D" groups=["delivery spot"]]
script = ExtResource("1_3e4vt")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@ -24,5 +27,11 @@ 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"]
[node name="Number Show" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Number Show"]
visible = false
shape = SubResource("CircleShape2D_ed5ba")
[connection signal="body_entered" from="Number Show" to="InteractibleManager" method="_on_body_entered"]
[connection signal="body_exited" from="Number Show" to="InteractibleManager" method="_on_body_exited"]

View file

@ -6,12 +6,10 @@
[ext_resource type="PackedScene" uid="uid://dpwqurhly8osd" path="res://scenes/interactible_manager.tscn" id="3_q68wy"]
[sub_resource type="CircleShape2D" id="CircleShape2D_8hxuu"]
radius = 168.19
radius = 431.001
[node name="Sign" type="Area2D" node_paths=PackedStringArray("Dialogue")]
[node name="Sign" type="Area2D"]
script = ExtResource("1_rtygf")
text = "Default Text"
Dialogue = NodePath("Dialogue")
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(0.4, 0.4)
@ -25,6 +23,7 @@ offset_bottom = -145.445
ItemShown = NodePath("../Dialogue")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
shape = SubResource("CircleShape2D_8hxuu")
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]

File diff suppressed because one or more lines are too long

28
scripts/contract_giver.gd Normal file
View file

@ -0,0 +1,28 @@
extends Area2D
@export var text : String
@onready var Dialogue : Control = $Dialogue
@export var ContractSpawnPositions : Array[Node2D]
@export var ContractScene : PackedScene
var PossibleContracts
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Dialogue.DialogueLabel.text = text
PossibleContracts = get_tree().get_nodes_in_group("delivery spot")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
for i in range(0, ContractSpawnPositions.size()):
if ContractSpawnPositions[i].get_child_count() == 0:
var newContract = ContractScene.instantiate()
newContract.Destination = PossibleContracts.pick_random()
newContract.Money = (int(newContract.Destination.global_position.distance_to(global_position))/100)*10
ContractSpawnPositions[i].add_child(newContract)

View file

@ -4,6 +4,8 @@ extends Area2D
@onready var InteractibleManager = $InteractibleManager
@export var HighestAddressParent : Node2D
var Player : Node2D
var WaitingCash : int = 0
@ -20,7 +22,12 @@ func _process(delta: float) -> void:
Player.ActiveContract = null
Player.Money += WaitingCash
func get_address(street: bool = true) -> String:
func get_address(full: bool = true) -> String:
var address = name
if(street): address += " " + get_parent().name
if(full):
var parentNode = get_parent()
while(parentNode != HighestAddressParent):
address += ", " + parentNode.name
parentNode = parentNode.get_parent()
address += ", " + parentNode.name
return address

View file

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

34
sprites/antred.png.import Normal file
View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 229 KiB

View file

@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dih2wjgfl4do"
uid="uid://ccrtrc15wtfsi"
path="res://.godot/imported/groundtile.jpg-91753d86441ea8b77f12ec0eeba2df7a.ctex"
metadata={
"vram_texture": false

BIN
sprites/tiles/walltile.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dih2wjgfl4do"
path="res://.godot/imported/walltile.jpg-9fa3784b8b1aae1e10a714e5e6ccfffd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/tiles/walltile.jpg"
dest_files=["res://.godot/imported/walltile.jpg-9fa3784b8b1aae1e10a714e5e6ccfffd.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=128
detect_3d/compress_to=1