small bugfixes

godot-4.1.1
John Montagu, the 4th Earl of Sandvich 2023-08-03 10:09:12 -07:00
parent 0aa90ea4b3
commit 7b85ffb5f6
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
9 changed files with 46 additions and 19 deletions

View File

@ -272,7 +272,10 @@ public partial class Character : CharacterBody2D, IFaction
{ {
HurtAnimation.Stop(); HurtAnimation.Stop();
HurtAnimation.Play("hurt"); HurtAnimation.Play("hurt");
HurtAnimation.Queue("hurt_flash"); if (HurtAnimation.HasAnimation("hurt_flash"))
{
HurtAnimation.Queue("hurt_flash");
}
} }
// if anyone involved is a player, shake their screen // if anyone involved is a player, shake their screen

View File

@ -373,7 +373,7 @@ use_parent_material = true
position = Vector2(0, -8) position = Vector2(0, -8)
texture = ExtResource("16_lr46v") texture = ExtResource("16_lr46v")
offset = Vector2(0, -4) offset = Vector2(0, -4)
hframes = 18 hframes = 35
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -4) position = Vector2(0, -4)

View File

@ -437,6 +437,7 @@ stream = ExtResource("13_bxguv")
stream = ExtResource("12_vvem5") stream = ExtResource("12_vvem5")
[node name="Camera2D" parent="." instance=ExtResource("4_ym125")] [node name="Camera2D" parent="." instance=ExtResource("4_ym125")]
zoom = Vector2(4, 4)
limit_smoothed = true limit_smoothed = true
position_smoothing_speed = 8.0 position_smoothing_speed = 8.0

View File

@ -10,13 +10,32 @@
[node name="World" type="Node2D" node_paths=PackedStringArray("UIController", "MusicPlayer", "DialogueBalloon")] [node name="World" type="Node2D" node_paths=PackedStringArray("UIController", "MusicPlayer", "DialogueBalloon")]
script = ExtResource("1_1k6ew") script = ExtResource("1_1k6ew")
StartingArea = ExtResource("2_pksaj") StartingArea = ExtResource("2_pksaj")
UIController = NodePath("CanvasLayer/UI") UIController = NodePath("CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI")
MusicPlayer = NodePath("MusicPlayer") MusicPlayer = NodePath("MusicPlayer")
DialogueBalloon = NodePath("DialogBalloon") DialogueBalloon = NodePath("CanvasLayer/SubViewportContainer/UIViewport/DialogBalloon")
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="UI" type="Control" parent="CanvasLayer" node_paths=PackedStringArray("BossBar")] [node name="SubViewportContainer" type="SubViewportContainer" parent="CanvasLayer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
stretch = true
stretch_shrink = 2
[node name="UIViewport" type="SubViewport" parent="CanvasLayer/SubViewportContainer"]
transparent_bg = true
handle_input_locally = false
size = Vector2i(960, 540)
render_target_update_mode = 4
[node name="DialogBalloon" parent="CanvasLayer/SubViewportContainer/UIViewport" instance=ExtResource("6_2bdwl")]
[node name="CanvasLayer" type="CanvasLayer" parent="CanvasLayer/SubViewportContainer/UIViewport"]
[node name="UI" type="Control" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer" node_paths=PackedStringArray("BossBar")]
z_index = 128 z_index = 128
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -29,23 +48,23 @@ size_flags_vertical = 3
script = ExtResource("3_fe62s") script = ExtResource("3_fe62s")
BossBar = NodePath("Bottom/BossBar") BossBar = NodePath("Bottom/BossBar")
[node name="Top" type="HBoxContainer" parent="CanvasLayer/UI"] [node name="Top" type="HBoxContainer" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI"]
layout_mode = 1 layout_mode = 1
anchors_preset = 10 anchors_preset = 10
anchor_right = 1.0 anchor_right = 1.0
offset_bottom = 40.0 offset_bottom = 40.0
grow_horizontal = 2 grow_horizontal = 2
[node name="Margin" type="MarginContainer" parent="CanvasLayer/UI/Top"] [node name="Margin" type="MarginContainer" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI/Top"]
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_left = 16 theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16 theme_override_constants/margin_top = 16
[node name="HealthBar" parent="CanvasLayer/UI/Top/Margin" instance=ExtResource("3_5rhge")] [node name="HealthBar" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI/Top/Margin" instance=ExtResource("3_5rhge")]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Bottom" type="HBoxContainer" parent="CanvasLayer/UI"] [node name="Bottom" type="HBoxContainer" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI"]
layout_mode = 1 layout_mode = 1
anchors_preset = 12 anchors_preset = 12
anchor_top = 1.0 anchor_top = 1.0
@ -56,7 +75,7 @@ grow_horizontal = 2
grow_vertical = 0 grow_vertical = 0
alignment = 1 alignment = 1
[node name="BossBar" parent="CanvasLayer/UI/Bottom" instance=ExtResource("5_8njq4")] [node name="BossBar" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI/Bottom" instance=ExtResource("5_8njq4")]
visible = false visible = false
layout_mode = 2 layout_mode = 2
@ -72,5 +91,3 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."] [node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
[node name="DialogBalloon" parent="." instance=ExtResource("6_2bdwl")]

View File

@ -11,7 +11,7 @@
[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="9_3401j"] [ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="9_3401j"]
[ext_resource type="Script" path="res://BoundingBoxes/ConnectorBox.cs" id="9_fg062"] [ext_resource type="Script" path="res://BoundingBoxes/ConnectorBox.cs" id="9_fg062"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_iqdtp"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_bk1di"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("5_h8k5p") shader = ExtResource("5_h8k5p")
shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/color = Quaternion(1, 1, 1, 1)
@ -111,7 +111,7 @@ visible = false
position = Vector2(120, -112) position = Vector2(120, -112)
[node name="Doc" parent="Entities" index="0" instance=ExtResource("4_ej0f3")] [node name="Doc" parent="Entities" index="0" instance=ExtResource("4_ej0f3")]
material = SubResource("ShaderMaterial_iqdtp") material = SubResource("ShaderMaterial_bk1di")
[node name="PointLight2D" type="PointLight2D" parent="Entities" index="1"] [node name="PointLight2D" type="PointLight2D" parent="Entities" index="1"]
position = Vector2(168, -42) position = Vector2(168, -42)

View File

@ -42,6 +42,10 @@ public partial class DocShungiteDartState : DocAttackState
protected override void Attack() protected override void Attack()
{ {
var player = NPC.FindBestTarget(); var player = NPC.FindBestTarget();
if (player is null)
{
return;
}
var playerPos = player.GlobalPosition; var playerPos = player.GlobalPosition;
// global position is (from npc to player) * 2 = (2 * npc) - player // global position is (from npc to player) * 2 = (2 * npc) - player
//projectile.GlobalPosition = 2 * NPC.GlobalPosition - playerPos; //projectile.GlobalPosition = 2 * NPC.GlobalPosition - playerPos;

View File

@ -49,6 +49,10 @@ public partial class DocShungiteSpikeState : DocShungiteDartState
protected override void Attack() protected override void Attack()
{ {
var player = NPC.FindBestTarget(); var player = NPC.FindBestTarget();
if (player is null)
{
return;
}
var playerPos = player.GlobalPosition; var playerPos = player.GlobalPosition;
var docPos = NPC.GlobalPosition; var docPos = NPC.GlobalPosition;
var projectile = SpawnProjectile(docPos, Vector2.Zero) as ShungiteSpike; var projectile = SpawnProjectile(docPos, Vector2.Zero) as ShungiteSpike;

View File

@ -33,10 +33,8 @@ public partial class DocUnwantedFrequencyState : DocShungiteSpikeState
protected override void Attack() protected override void Attack()
{ {
Doc.TelegraphAnimation.Play("unwanted_frequencies"); Doc.TelegraphAnimation.Play("unwanted_frequencies");
var player = _world.CurrentPlayer;
var playerPos = player.GlobalPosition;
var docPos = NPC.GlobalPosition; var docPos = NPC.GlobalPosition;
var projectile = SpawnProjectile(docPos, docPos.DirectionTo(playerPos)) var projectile = SpawnProjectile(docPos, Vector2.Zero)
as UnwantedFrequency; as UnwantedFrequency;
projectile.CharacterTarget = NPC.FindBestTarget(); projectile.CharacterTarget = NPC.FindBestTarget();

View File

@ -30,8 +30,8 @@ general/wrap_lines=true
[display] [display]
window/size/viewport_width=640 window/size/viewport_width=1920
window/size/viewport_height=360 window/size/viewport_height=1080
window/stretch/mode="viewport" window/stretch/mode="viewport"
window/stretch/aspect="expand" window/stretch/aspect="expand"