Started work on contract selection, needs to be finished
This commit is contained in:
parent
57fbbbf0cf
commit
f46fc5612f
|
@ -50,6 +50,11 @@ right={
|
|||
, 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)
|
||||
]
|
||||
}
|
||||
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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cn41xqc3lwaxy"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cn41xqc3lwaxy"]
|
||||
|
||||
[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"]
|
||||
|
@ -7,17 +8,21 @@
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_mxuxo"]
|
||||
radius = 217.993
|
||||
|
||||
[node name="Contract" type="Area2D"]
|
||||
[node name="Contract" type="Area2D" node_paths=PackedStringArray("DestinationLabel", "InteractibleManager")]
|
||||
script = ExtResource("1_esxg1")
|
||||
Destination = "20th Burnaby"
|
||||
DestinationLabel = NodePath("Control/LabelPanel/Label")
|
||||
InteractibleManager = NodePath("InteractibleManager")
|
||||
|
||||
[node name="LabelPanel" type="Panel" parent="."]
|
||||
[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
|
||||
offset_left = -313.0
|
||||
offset_top = -342.0
|
||||
offset_right = 369.0
|
||||
offset_bottom = -242.0
|
||||
theme = ExtResource("1_m2twt")
|
||||
|
||||
[node name="Label" type="Label" parent="LabelPanel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -25,10 +30,13 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_m2twt")
|
||||
text = "20th Burnaby Lane - $300"
|
||||
|
||||
[node name="Label" type="Label" parent="Control/LabelPanel"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_m2twt")
|
||||
text = "20th Burnaby"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
clip_text = true
|
||||
uppercase = true
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
|
@ -39,7 +47,7 @@ texture = ExtResource("1_jwp1o")
|
|||
shape = SubResource("CircleShape2D_mxuxo")
|
||||
|
||||
[node name="InteractibleManager" parent="." node_paths=PackedStringArray("ItemShown") instance=ExtResource("3_khqae")]
|
||||
ItemShown = NodePath("../LabelPanel")
|
||||
ItemShown = NodePath("../Control/LabelPanel")
|
||||
|
||||
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="InteractibleManager" method="_on_body_exited"]
|
||||
|
|
|
@ -17,15 +17,14 @@ size = Vector2(409, 181)
|
|||
texture = ExtResource("1_awtl7")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="LabelPanel" type="Panel" parent="."]
|
||||
z_index = 10
|
||||
offset_left = -313.0
|
||||
offset_top = -342.0
|
||||
offset_right = 369.0
|
||||
offset_bottom = -242.0
|
||||
theme = ExtResource("2_v5tdy")
|
||||
[node name="Control" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_top = -256.34
|
||||
offset_bottom = -256.34
|
||||
|
||||
[node name="Label" type="Label" parent="LabelPanel"]
|
||||
[node name="LabelPanel" type="PanelContainer" parent="Control"]
|
||||
z_index = 10
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -33,10 +32,13 @@ 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
|
||||
clip_text = true
|
||||
uppercase = true
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
|
@ -54,6 +56,7 @@ 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)
|
||||
|
@ -62,7 +65,7 @@ position = Vector2(113, 753)
|
|||
position = Vector2(710, 753)
|
||||
|
||||
[node name="InteractibleManager" parent="." node_paths=PackedStringArray("ItemShown") instance=ExtResource("4_1m1bm")]
|
||||
ItemShown = NodePath("../LabelPanel")
|
||||
ItemShown = NodePath("../Control/LabelPanel")
|
||||
|
||||
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="InteractibleManager" method="_on_body_exited"]
|
||||
|
|
20
scripts/contract.gd
Normal file
20
scripts/contract.gd
Normal file
|
@ -0,0 +1,20 @@
|
|||
extends Area2D
|
||||
|
||||
@export var Destination : String
|
||||
@export var DestinationLabel : Label
|
||||
|
||||
@export var InteractibleManager : Node
|
||||
|
||||
var Player : Node2D
|
||||
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
DestinationLabel.text = Destination
|
||||
|
||||
|
||||
# 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:
|
||||
Player.ActiveContract = Destination
|
|
@ -2,6 +2,8 @@ extends Node
|
|||
|
||||
@export var ItemShown : Control
|
||||
|
||||
var selected = false
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
ItemShown.hide()
|
||||
|
@ -16,7 +18,9 @@ func _process(delta: float) -> void:
|
|||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
ItemShown.show()
|
||||
selected = true
|
||||
|
||||
func _on_body_exited(body: Node2D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
ItemShown.hide()
|
||||
selected = false
|
||||
|
|
|
@ -6,6 +6,8 @@ extends CharacterBody2D
|
|||
@export var Sprite : Sprite2D
|
||||
var SpriteTurningSpeed = 5
|
||||
|
||||
var ActiveContract : Node2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
|
Loading…
Reference in a new issue