Simple fetchquest implemented.
parent
eeff59a413
commit
645c02f384
130
Game.tscn
130
Game.tscn
|
@ -1,10 +1,9 @@
|
|||
[gd_scene load_steps=41 format=3 uid="uid://bugqatylloxkl"]
|
||||
[gd_scene load_steps=37 format=3 uid="uid://bugqatylloxkl"]
|
||||
|
||||
[ext_resource type="Script" path="res://Player.gd" id="1_3lyis"]
|
||||
[ext_resource type="Script" path="res://World.gd" id="1_e417k"]
|
||||
[ext_resource type="Script" path="res://Game.gd" id="1_h44o7"]
|
||||
[ext_resource type="Script" path="res://RootUI.gd" id="2_gg3gt"]
|
||||
[ext_resource type="PackedScene" uid="uid://dk2wv1vem0ubw" path="res://assets/scene_props/RockA.tscn" id="3_owduk"]
|
||||
[ext_resource type="PackedScene" uid="uid://dy8vjf760prhq" path="res://assets/characters/Rogue.tscn" id="4_6mbva"]
|
||||
[ext_resource type="Script" path="res://model/quest_state.gd" id="4_fmwrw"]
|
||||
[ext_resource type="Texture2D" uid="uid://cq8ypeagpedq" path="res://assets/kenney/ui-pack-rpg-expansion/PNG/cursorSword_bronze.png" id="4_pcyi0"]
|
||||
|
@ -20,14 +19,22 @@
|
|||
[ext_resource type="PackedScene" uid="uid://dhpc2xvlfln7o" path="res://objects/Actionable.tscn" id="14_qb8uo"]
|
||||
[ext_resource type="Resource" uid="uid://b1gd54koq1h7o" path="res://dialogue/testdialogue.dialogue" id="15_2n7cr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwui4acukq4x6" path="res://ui/item_grid.tscn" id="15_5xu2a"]
|
||||
[ext_resource type="PackedScene" uid="uid://o6d18r0ior12" path="res://assets/scene_props/RockB.tscn" id="17_h8tnl"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnobr4inhiskv" path="res://assets/kenney/platformer-kit/Models/GLB format/tree-pine.glb" id="21_5210s"]
|
||||
[ext_resource type="PackedScene" uid="uid://m4tk7vhjy310" path="res://assets/kenney/platformer-kit/Models/GLB format/tree.glb" id="22_xm4au"]
|
||||
[ext_resource type="PackedScene" uid="uid://cgde10y3e7w86" path="res://assets/kenney/platformer-kit/Models/GLB format/rocks.glb" id="23_ve8c6"]
|
||||
[ext_resource type="PackedScene" uid="uid://dg1rtct0vrk3p" path="res://assets/kenney/platformer-kit/Models/GLB format/poles.glb" id="24_a3mo8"]
|
||||
[ext_resource type="PackedScene" uid="uid://kpyvcyklt68g" path="res://assets/scene_props/bridge.tscn" id="25_qvbtw"]
|
||||
[ext_resource type="PackedScene" uid="uid://cej0a41nm3eh7" path="res://assets/kenney/platformer-kit/Models/GLB format/mushrooms.glb" id="25_tea3k"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_y65pc"]
|
||||
|
||||
[sub_resource type="Sky" id="Sky_wbut8"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_y65pc")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_v85yo"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_wbut8")
|
||||
ambient_light_source = 3
|
||||
ambient_light_color = Color(0.662452, 0.662452, 0.662452, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jd31k"]
|
||||
|
@ -38,41 +45,13 @@ material = SubResource("StandardMaterial3D_jd31k")
|
|||
radius = 0.12
|
||||
height = 0.6
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_vq44x"]
|
||||
height = 0.6
|
||||
radius = 0.158352
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_7kfad"]
|
||||
radius = 0.24158
|
||||
height = 0.952333
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_wrkyq"]
|
||||
radius = 0.194932
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_q3pbi"]
|
||||
size = Vector3(100, 1, 100)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_dpmxf"]
|
||||
offsets = PackedFloat32Array(0, 0.00293255, 0.0879765, 0.178886, 0.642229)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.22963, 0.22963, 0.22963, 1, 0.753482, 0.753482, 0.753482, 1, 0.722667, 0.722667, 0.722667, 1, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_rqttx"]
|
||||
frequency = 0.0243
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_uig1c"]
|
||||
width = 32
|
||||
height = 32
|
||||
seamless = true
|
||||
seamless_blend_skirt = 1.0
|
||||
color_ramp = SubResource("Gradient_dpmxf")
|
||||
noise = SubResource("FastNoiseLite_rqttx")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5680i"]
|
||||
albedo_color = Color(0.211765, 0.721569, 0.145098, 1)
|
||||
albedo_texture = SubResource("NoiseTexture2D_uig1c")
|
||||
uv1_triplanar = true
|
||||
texture_filter = 0
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_i7opf"]
|
||||
material = SubResource("StandardMaterial3D_5680i")
|
||||
size = Vector3(100, 1, 100)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ikb15"]
|
||||
vertex_color_is_srgb = true
|
||||
albedo_color = Color(1, 1, 0.172549, 1)
|
||||
|
@ -82,6 +61,10 @@ material = SubResource("StandardMaterial3D_ikb15")
|
|||
radius = 0.12
|
||||
height = 0.6
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_vq44x"]
|
||||
height = 0.6
|
||||
radius = 0.158352
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_6nrvr"]
|
||||
|
||||
[node name="Game" type="Node3D"]
|
||||
|
@ -108,8 +91,8 @@ visible = false
|
|||
mesh = SubResource("CapsuleMesh_dwrtd")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Player"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.310637, 0)
|
||||
shape = SubResource("CylinderShape3D_vq44x")
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.470516, 0)
|
||||
shape = SubResource("CapsuleShape3D_7kfad")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="World/Player"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.460138, 0.887848, 0, -0.887848, 0.460138, 0, 2.91421, 1.186)
|
||||
|
@ -133,43 +116,6 @@ shape = SubResource("SphereShape3D_wrkyq")
|
|||
transform = Transform3D(0.836133, 0.124138, 0.534295, -0.548527, 0.189226, 0.81444, 0, -0.974055, 0.226311, 5.06819, 4.51394, 0)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Disabled" type="Node3D" parent="World"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1000, -1000, 0)
|
||||
|
||||
[node name="Level" type="Node3D" parent="World/Disabled"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1000, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="rockB3" parent="World/Disabled/Level" instance=ExtResource("17_h8tnl")]
|
||||
transform = Transform3D(8, 0, 0, 0, 8, 0, 0, 0, 8, 0.367403, 0, -5.10016)
|
||||
|
||||
[node name="rockB4" parent="World/Disabled/Level" instance=ExtResource("17_h8tnl")]
|
||||
transform = Transform3D(7.81859, 0, -1.69401, 0, 8, 0, 1.69401, 0, 7.81859, 4.26316, 0, -3.19084)
|
||||
|
||||
[node name="rockB5" parent="World/Disabled/Level" instance=ExtResource("17_h8tnl")]
|
||||
transform = Transform3D(7.6853, 0, 2.22174, 0, 8, 0, -2.22174, 0, 7.6853, -4.43364, -9.53674e-07, 3.35167)
|
||||
|
||||
[node name="rockB6" parent="World/Disabled/Level" instance=ExtResource("17_h8tnl")]
|
||||
transform = Transform3D(7.6853, 0, 2.22174, 0, 8, 0, -2.22174, 0, 7.6853, -0.978873, -4.76837e-07, 6.57311)
|
||||
|
||||
[node name="rockB7" parent="World/Disabled/Level" instance=ExtResource("17_h8tnl")]
|
||||
transform = Transform3D(5.02262, 0, 6.22682, 0, 8, 0, -6.22682, 0, 5.02262, 2.60543, -4.76837e-07, 5.72751)
|
||||
|
||||
[node name="RockC" parent="World/Disabled/Level" instance=ExtResource("3_owduk")]
|
||||
transform = Transform3D(-4.60411, -0.210968, -6.53893, -0.209429, 7.99649, -0.110533, 6.53898, 0.107567, -4.60762, -4.78623, 4.76837e-07, -2.1916)
|
||||
|
||||
[node name="GroundPlane" type="StaticBody3D" parent="World/Disabled"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1000, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="GroundMesh" type="CollisionShape3D" parent="World/Disabled/GroundPlane"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
|
||||
shape = SubResource("BoxShape3D_q3pbi")
|
||||
|
||||
[node name="GroundMesh" type="MeshInstance3D" parent="World/Disabled/GroundPlane/GroundMesh"]
|
||||
mesh = SubResource("BoxMesh_i7opf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
|
||||
[node name="Merchant" type="CharacterBody3D" parent="World"]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 3.64783, 0, -1.58598)
|
||||
|
||||
|
@ -201,6 +147,29 @@ shape = SubResource("SphereShape3D_6nrvr")
|
|||
|
||||
[node name="Level" parent="World" instance=ExtResource("11_m8tt7")]
|
||||
|
||||
[node name="Decorations" type="Node3D" parent="World"]
|
||||
|
||||
[node name="tree-pine2" parent="World/Decorations" instance=ExtResource("21_5210s")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.754677, 0, 0.0391712)
|
||||
|
||||
[node name="tree2" parent="World/Decorations" instance=ExtResource("22_xm4au")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.80764, 0, -3.13532)
|
||||
|
||||
[node name="rocks2" parent="World/Decorations" instance=ExtResource("23_ve8c6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3817, -4.76837e-07, -3.3938)
|
||||
|
||||
[node name="poles2" parent="World/Decorations" instance=ExtResource("24_a3mo8")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.56186, 0, -3.13331)
|
||||
|
||||
[node name="mushrooms2" parent="World/Decorations" instance=ExtResource("25_tea3k")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.851, 0, 0.798104)
|
||||
|
||||
[node name="Bridge" type="Node3D" parent="World"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="BridgePart2" parent="World/Bridge" instance=ExtResource("25_qvbtw")]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 5.723, 0, -1.439)
|
||||
|
||||
[node name="RootUI" type="CanvasLayer" parent="."]
|
||||
script = ExtResource("2_gg3gt")
|
||||
|
||||
|
@ -674,21 +643,6 @@ layout_mode = 2
|
|||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="tree-pine2" parent="." instance=ExtResource("21_5210s")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.754677, 0, 0.0391712)
|
||||
|
||||
[node name="tree2" parent="." instance=ExtResource("22_xm4au")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.80764, 0, -3.13532)
|
||||
|
||||
[node name="rocks2" parent="." instance=ExtResource("23_ve8c6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3817, -4.76837e-07, -3.3938)
|
||||
|
||||
[node name="poles2" parent="." instance=ExtResource("24_a3mo8")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.921204, 0, -3.30199)
|
||||
|
||||
[node name="mushrooms2" parent="." instance=ExtResource("25_tea3k")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.851, 0, 0.798104)
|
||||
|
||||
[connection signal="pressed" from="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer/NewGameButton" to="RootUI" method="_on_new_game_button_pressed"]
|
||||
[connection signal="pressed" from="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer3/QuitButton" to="RootUI" method="_on_quit_button_pressed"]
|
||||
[connection signal="pressed" from="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer/BackButton" to="RootUI" method="_to_main_menu_button_pressed"]
|
||||
|
|
10
Player.gd
10
Player.gd
|
@ -6,6 +6,7 @@ const JUMP_VELOCITY = 2.5
|
|||
@onready var geometry = %Geometry
|
||||
@onready var actionable_detector = %ActionableDetector
|
||||
@onready var quest_state = %QuestState
|
||||
@onready var bridge = %Bridge
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
|
@ -41,17 +42,10 @@ func _physics_process(delta):
|
|||
geometry.look_at(position - last_nonzero_velocity, Vector3.UP)
|
||||
|
||||
|
||||
func update_quest_state() -> void:
|
||||
for item:Item in inventory.get_items():
|
||||
if item.name == "Wrench":
|
||||
quest_state.has_wrench = true
|
||||
|
||||
|
||||
|
||||
func on_item_picked_up(item:Item):
|
||||
emit_signal("trigger_message", "Picked up a " + item.name)
|
||||
inventory.add_item(item)
|
||||
update_quest_state()
|
||||
quest_state.update_state_from_player_inventory(inventory)
|
||||
|
||||
|
||||
func _unhandled_input(_event: InputEvent) -> void:
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,12 +4,12 @@ Chloe: Mist! Ohne meinen Hammer kann ich die Brücke nicht fertig bauen!
|
|||
Chloe: Hast Du meinen Hammer gesehen?
|
||||
|
||||
- Ja!
|
||||
if has_wrench == false:
|
||||
if is_wrench_found == false:
|
||||
Chloe: Du scheinst keinen Hammer zu haben. Oder weißt nicht was ein Hammer ist.
|
||||
else:av
|
||||
Chloe: Danke!
|
||||
|
||||
set bridge_built_by_engineer = true
|
||||
set is_wrench_delivered = true
|
||||
- Lieber nicht.
|
||||
Chloe: Schade!
|
||||
- Wo kann er denn sein?
|
||||
|
|
|
@ -1,5 +1,33 @@
|
|||
class_name QuestState
|
||||
extends Node
|
||||
|
||||
@export var has_wrench:bool = false
|
||||
@export var bridge_built_by_engineer:bool = false
|
||||
@export var is_wrench_found:bool = false
|
||||
@export var is_wrench_delivered:bool = false
|
||||
@export var is_bridge_built:bool = false
|
||||
|
||||
@onready var bridge = %Bridge
|
||||
|
||||
var _bridge_transform:Transform3D = Transform3D.IDENTITY
|
||||
|
||||
signal wrench_delivered
|
||||
|
||||
func _ready():
|
||||
_bridge_transform = bridge.global_transform
|
||||
bridge.global_transform = Transform3D.IDENTITY.translated(Vector3.UP * -1000)
|
||||
|
||||
func on_dialogue_ended(_dialog_resource: DialogueResource) -> void:
|
||||
if is_wrench_delivered:
|
||||
print ("Will build bridge!")
|
||||
emit_signal("wrench_delivered")
|
||||
|
||||
|
||||
func update_state_from_player_inventory(inventory: Inventory) -> void:
|
||||
for item:Item in inventory.get_items():
|
||||
if item.name == "Wrench":
|
||||
is_wrench_found = true
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
if is_wrench_delivered:
|
||||
is_bridge_built = true
|
||||
bridge.global_transform = _bridge_transform
|
||||
|
|
|
@ -3,7 +3,8 @@ extends Area3D
|
|||
@export var dialogue_resource: DialogueResource
|
||||
@export var dialogue_start: String = "start"
|
||||
|
||||
func action(game_state: QuestState) -> void:
|
||||
func action(quest_state: QuestState) -> void:
|
||||
var balloon = load("res://ui/dialogue/balloon.tscn").instantiate()
|
||||
DialogueManager.connect("dialogue_ended", quest_state.on_dialogue_ended)
|
||||
get_tree().current_scene.add_child(balloon)
|
||||
balloon.start(dialogue_resource, dialogue_start, [game_state])
|
||||
balloon.start(dialogue_resource, dialogue_start, [quest_state])
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
[node name="ExampleBalloon" type="CanvasLayer"]
|
||||
layer = 100
|
||||
script = ExtResource("1_36de5")
|
||||
next_action = null
|
||||
skip_action = null
|
||||
|
||||
[node name="Balloon" type="Control" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
|
|
@ -22,9 +22,9 @@ cell_center_x = false
|
|||
cell_center_y = false
|
||||
cell_center_z = false
|
||||
data = {
|
||||
"cells": PackedInt32Array(0, 0, 14, 3, 0, 14, 6, 0, 14, 0, 65533, 14, 3, 65533, 14, 0, 3, 14, 3, 3, 14, 6, 3, 14, 6, 65533, 14, 9, 65533, 14, 6, 65530, 14, 3, 65530, 14, 0, 65530, 14, 65533, 65530, 14, 65533, 65533, 14, 65533, 0, 14, 65533, 3, 14, 65545, 1, 1441801, 65545, 4, 1441801, 65545, 65530, 1441801, 65543, 65528, 9, 65540, 65528, 9, 131067, 65529, 1441801, 131067, 65532, 1441801, 131067, 65535, 1441801, 131067, 2, 1441801, 131068, 65528, 9, 65544, 5, 9, 65538, 5, 9, 131071, 5, 9, 131068, 5, 9, 131067, 3, 1441801, 12, 65533, 14, 12, 0, 14, 12, 65530, 14, 15, 65530, 14, 15, 65527, 14, 15, 65524, 14, 18, 65524, 14, 21, 65524, 14, 21, 65527, 14, 21, 65530, 14, 24, 65530, 14, 24, 65533, 14, 27, 65533, 14, 30, 65533, 14, 33, 65533, 14, 33, 65530, 14, 36, 65530, 14, 36, 65533, 14, 36, 65527, 14, 39, 65527, 14, 39, 65530, 14, 39, 65524, 14, 42, 65524, 14, 39, 65533, 14, 42, 65533, 14, 42, 65530, 14)
|
||||
"cells": PackedInt32Array(0, 0, 14, 3, 0, 14, 6, 0, 14, 0, 65533, 14, 3, 65533, 14, 0, 3, 14, 3, 3, 14, 6, 3, 14, 6, 65533, 14, 6, 65530, 14, 3, 65530, 14, 0, 65530, 14, 65533, 65530, 14, 65533, 65533, 14, 65533, 0, 14, 65533, 3, 14, 65545, 1, 1441801, 65545, 4, 1441801, 65545, 65530, 1441801, 65543, 65528, 9, 65540, 65528, 9, 131067, 65529, 1441801, 131067, 65532, 1441801, 131067, 65535, 1441801, 131067, 2, 1441801, 131068, 65528, 9, 65544, 5, 9, 65538, 5, 9, 131071, 5, 9, 131068, 5, 9, 131067, 3, 1441801, 15, 65530, 14, 15, 65527, 14, 15, 65524, 14, 18, 65524, 14, 21, 65524, 14, 21, 65527, 14, 21, 65530, 14, 24, 65530, 14, 24, 65533, 14, 27, 65533, 14, 30, 65533, 14, 33, 65533, 14, 33, 65530, 14, 36, 65530, 14, 36, 65533, 14, 36, 65527, 14, 39, 65527, 14, 39, 65530, 14, 39, 65524, 14, 42, 65524, 14, 39, 65533, 14, 42, 65533, 14, 42, 65530, 14, 8, 65532, 14, 8, 65534, 14, 15, 65533, 14, 15, 65535, 14, 15, 1, 14)
|
||||
}
|
||||
metadata/_editor_floor_ = Vector3(0, 1, 0)
|
||||
metadata/_editor_floor_ = Vector3(0, 0, 0)
|
||||
|
||||
[node name="Objects" type="Node3D" parent="."]
|
||||
|
||||
|
|
Loading…
Reference in New Issue