dialogue stuff didnt commit

This commit is contained in:
2023-01-31 15:12:40 +01:00
parent e9fd520194
commit c86931a2cf
2 changed files with 7 additions and 5 deletions

View File

@@ -99,7 +99,9 @@ script = ExtResource("1_qehox")
rotation = 3.14159 rotation = 3.14159
target_position = Vector2(-64, 0) target_position = Vector2(-64, 0)
collision_mask = 2 collision_mask = 2
hit_from_inside = true
collide_with_areas = true collide_with_areas = true
collide_with_bodies = false
[node name="animated_sprite_2d" type="AnimatedSprite2D" parent="."] [node name="animated_sprite_2d" type="AnimatedSprite2D" parent="."]
texture_filter = 1 texture_filter = 1

View File

@@ -3,18 +3,19 @@ using System;
public partial class player : CharacterBody2D public partial class player : CharacterBody2D
{ {
[Export] public string playerName; [Export] public string playerName;
[Export] public int speed = 200; [Export] public int speed = 200;
public Vector2 movement; public Vector2 movement;
public AnimatedSprite2D animatedSprite; public AnimatedSprite2D animatedSprite;
public Marker2D rotCenter; public Marker2D rotCenter;
public RayCast2D rayCast; public RayCast2D dialogRayCast;
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"); dialogRayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
} }
public void ChangeProcess(bool process) public void ChangeProcess(bool process)
{ {
@@ -29,9 +30,8 @@ public partial class player : CharacterBody2D
} }
public override void _Process(double delta) public override void _Process(double delta)
{ {
//call event in raycasted object if (Input.IsActionJustPressed("ui_accept") && dialogRayCast.IsColliding())
if (Input.IsActionJustPressed("ui_accept") && rayCast.IsColliding()) dialog_bubble.SetDialog(dialogRayCast.GetCollider().Get("dialogFile").AsString());
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)