small smart dialogue system change

This commit is contained in:
2023-01-28 15:12:43 +01:00
parent 8826213317
commit a88a8cdac7
5 changed files with 13 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://src/scene-scripts/player.cs" id="1_qehox"] [ext_resource type="Script" path="res://src/scene-scripts/player.cs" id="1_qehox"]
[ext_resource type="Texture2D" uid="uid://olceowuycu8c" path="res://assets/textures/debug/dummy-player-atlas.png" id="2_yu1q5"] [ext_resource type="Texture2D" uid="uid://olceowuycu8c" path="res://assets/textures/debug/dummy-player-atlas.png" id="2_yu1q5"]
[ext_resource type="PackedScene" uid="uid://d6ngurhq1r5y" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"] [ext_resource type="PackedScene" uid="uid://dcb1x11exmlab" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"]
[sub_resource type="AtlasTexture" id="AtlasTexture_tokqm"] [sub_resource type="AtlasTexture" id="AtlasTexture_tokqm"]
atlas = ExtResource("2_yu1q5") atlas = ExtResource("2_yu1q5")
@@ -85,11 +85,12 @@ animations = [{
}] }]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_38v5o"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_38v5o"]
radius = 5.99732 radius = 13.9973
height = 45.968 height = 45.968
[node name="player" type="CharacterBody2D"] [node name="player" type="CharacterBody2D"]
process_mode = 1 process_mode = 1
y_sort_enabled = true
script = ExtResource("1_qehox") script = ExtResource("1_qehox")
[node name="rotation_center" type="Marker2D" parent="."] [node name="rotation_center" type="Marker2D" parent="."]
@@ -107,7 +108,7 @@ frames = SubResource("SpriteFrames_2x1cy")
animation = &"move_down" animation = &"move_down"
[node name="collision_shape" type="CollisionShape2D" parent="."] [node name="collision_shape" type="CollisionShape2D" parent="."]
position = Vector2(3.72529e-09, 39) position = Vector2(0, 31)
rotation = 1.57345 rotation = 1.57345
shape = SubResource("CapsuleShape2D_38v5o") shape = SubResource("CapsuleShape2D_38v5o")

View File

@@ -4,7 +4,7 @@
[ext_resource type="PackedScene" uid="uid://hyhe4kitrbt6" path="res://scenes/dialog_trigger_area.tscn" id="2_blpmd"] [ext_resource type="PackedScene" uid="uid://hyhe4kitrbt6" path="res://scenes/dialog_trigger_area.tscn" id="2_blpmd"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pchpi"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_pchpi"]
size = Vector2(64, 58.5) size = Vector2(64, 17.25)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_d78tr"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_d78tr"]
size = Vector2(64, 58) size = Vector2(64, 58)
@@ -15,6 +15,7 @@ size = Vector2(64, 58)
texture = ExtResource("1_imilm") texture = ExtResource("1_imilm")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 20.625)
shape = SubResource("RectangleShape2D_pchpi") shape = SubResource("RectangleShape2D_pchpi")
[node name="dialog_trigger_area" parent="." instance=ExtResource("2_blpmd")] [node name="dialog_trigger_area" parent="." instance=ExtResource("2_blpmd")]

View File

@@ -12,8 +12,10 @@ format = 2
layer_0/tile_data = PackedInt32Array(-65535, 65536, 1, -131071, 65536, 1, -65536, 65536, 1, -131072, 65536, 1, -1, 65536, 1, -65537, 65536, 1, 3, 131072, 2, -65533, 131072, 1, -131069, 131072, 1, 2, 65536, 2, -65534, 65536, 1, -131070, 65536, 1, 1, 65536, 2, 0, 65536, 2, 65535, 65536, 2, 65534, 0, 2, -2, 0, 1, -65538, 0, 1, -65540, 131072, 0, -65541, 65536, 0, -5, 65536, 1, -6, 0, 1, -65542, 0, 0, 65530, 0, 2, 65531, 65536, 2, -4, 131072, 1, 65532, 131072, 2, -196605, 131072, 0, -196606, 65536, 0, -196607, 65536, 0, -196608, 65536, 0, -131073, 65536, 0, -131074, 0, 0) layer_0/tile_data = PackedInt32Array(-65535, 65536, 1, -131071, 65536, 1, -65536, 65536, 1, -131072, 65536, 1, -1, 65536, 1, -65537, 65536, 1, 3, 131072, 2, -65533, 131072, 1, -131069, 131072, 1, 2, 65536, 2, -65534, 65536, 1, -131070, 65536, 1, 1, 65536, 2, 0, 65536, 2, 65535, 65536, 2, 65534, 0, 2, -2, 0, 1, -65538, 0, 1, -65540, 131072, 0, -65541, 65536, 0, -5, 65536, 1, -6, 0, 1, -65542, 0, 0, 65530, 0, 2, 65531, 65536, 2, -4, 131072, 1, 65532, 131072, 2, -196605, 131072, 0, -196606, 65536, 0, -196607, 65536, 0, -196608, 65536, 0, -131073, 65536, 0, -131074, 0, 0)
[node name="foreground" type="TileMap" parent="."] [node name="foreground" type="TileMap" parent="."]
y_sort_enabled = true
tile_set = ExtResource("2_kvjhj") tile_set = ExtResource("2_kvjhj")
cell_quadrant_size = 64 cell_quadrant_size = 64
format = 2 format = 2
layer_0/z_index = 1 layer_0/y_sort_enabled = true
layer_0/y_sort_origin = 40
layer_0/tile_data = PackedInt32Array(1, 0, 0, 65533, 0, 0, -3, 0, 0, -65535, 0, 0, 65529, 1, 65536, 65541, 1, 65536, -196605, 1, 65536, 196603, 1, 65536, -196603, 1, 65536, -196600, 1, 65536, -131086, 2, 65536) layer_0/tile_data = PackedInt32Array(1, 0, 0, 65533, 0, 0, -3, 0, 0, -65535, 0, 0, 65529, 1, 65536, 65541, 1, 65536, -196605, 1, 65536, 196603, 1, 65536, -196603, 1, 65536, -196600, 1, 65536, -131086, 2, 65536)

View File

@@ -1,4 +1,3 @@
//WORK IN PROGRESS this code is very messy and will be fixed when it works
using Godot; using Godot;
using System; using System;

View File

@@ -8,11 +8,13 @@ public partial class player : CharacterBody2D
public Vector2 movement; public Vector2 movement;
public AnimatedSprite2D animatedSprite; public AnimatedSprite2D animatedSprite;
public Marker2D rotCenter; public Marker2D rotCenter;
public RayCast2D rayCast;
public override void _Ready() public override void _Ready()
{ {
animatedSprite = GetNode<AnimatedSprite2D>("animated_sprite_2d"); animatedSprite = GetNode<AnimatedSprite2D>("animated_sprite_2d");
rotCenter = GetNode<Marker2D>("rotation_center"); rotCenter = GetNode<Marker2D>("rotation_center");
rayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
} }
public void ChangeProcess(bool process) public void ChangeProcess(bool process)
{ {
@@ -27,10 +29,9 @@ public partial class player : CharacterBody2D
} }
public override void _Process(double delta) public override void _Process(double delta)
{ {
//call event in raycasted object //call event in raycasted object
/*if (Input.IsActionJustPressed("ui_accept") && rayCast.IsColliding()) if (Input.IsActionJustPressed("ui_accept") && rayCast.IsColliding())
rayCast.GetCollider().Call("OnInteraction", playerName);*/ rayCast.GetCollider().Call("OnInteraction", playerName);
//animation system (with controller support wich cant get normalized vector) //animation system (with controller support wich cant get normalized vector)
if (movement.Length() != 0) if (movement.Length() != 0)