7 minutes

This commit is contained in:
Иван Кузьменко 2023-08-19 15:53:31 +03:00
parent 4d3ac1e4fb
commit 50c6e98481
6 changed files with 212 additions and 26 deletions

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://c1dj6cg6x2nsd"]
[ext_resource type="Script" path="res://scripts/entities/And.cs" id="1_s2pvp"]
[node name="And" type="Node"]
script = ExtResource("1_s2pvp")

File diff suppressed because one or more lines are too long

View file

@ -86,6 +86,126 @@ position = Vector2(166, 256)
[node name="PS" type="Node2D" parent="Zones/PlayZone1"]
position = Vector2(55, 127)
[node name="PlayZone2" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(33, 416)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone2"]
position = Vector2(1, 0)
[node name="BR" type="Node2D" parent="Zones/PlayZone2"]
position = Vector2(477, 94)
[node name="PS" type="Node2D" parent="Zones/PlayZone2"]
position = Vector2(48, 22)
[node name="PlayZone3" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(609, 354)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone3"]
position = Vector2(1, 0)
[node name="BR" type="Node2D" parent="Zones/PlayZone3"]
position = Vector2(283, 187)
[node name="PS" type="Node2D" parent="Zones/PlayZone3"]
position = Vector2(23, 110)
[node name="PlayZone4" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(997, -889)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone4"]
position = Vector2(0, 4)
[node name="BR" type="Node2D" parent="Zones/PlayZone4"]
position = Vector2(1129, 1709)
[node name="PS" type="Node2D" parent="Zones/PlayZone4"]
position = Vector2(51, 1290)
[node name="PlayZone5" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(608, -106)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone5"]
position = Vector2(1, 0)
[node name="BR" type="Node2D" parent="Zones/PlayZone5"]
position = Vector2(291, 238)
[node name="PS" type="Node2D" parent="Zones/PlayZone5"]
position = Vector2(143, 214)
[node name="PlayZone6" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(605, -515)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone6"]
position = Vector2(1, 0)
[node name="BR" type="Node2D" parent="Zones/PlayZone6"]
position = Vector2(289, 224)
[node name="PS" type="Node2D" parent="Zones/PlayZone6"]
position = Vector2(153, 209)
[node name="PlayZone7" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(610, -930)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone7"]
position = Vector2(1, 0)
[node name="BR" type="Node2D" parent="Zones/PlayZone7"]
position = Vector2(289, 224)
[node name="PS" type="Node2D" parent="Zones/PlayZone7"]
position = Vector2(153, 209)
[node name="PlayZone8" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(-435, -1211)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone8"]
position = Vector2(1, 0)
[node name="BR" type="Node2D" parent="Zones/PlayZone8"]
position = Vector2(931, 1085)
[node name="PS" type="Node2D" parent="Zones/PlayZone8"]
position = Vector2(738, 1016)
[node name="PlayZone9" parent="Zones" node_paths=PackedStringArray("TopLeftCorner", "BottomRightCorner", "PlayerSpawnPoint") instance=ExtResource("4_5sggf")]
position = Vector2(449, 833)
TopLeftCorner = NodePath("TL")
BottomRightCorner = NodePath("BR")
PlayerSpawnPoint = NodePath("PS")
[node name="TL" type="Node2D" parent="Zones/PlayZone9"]
position = Vector2(1, 0)
[node name="BR" type="Node2D" parent="Zones/PlayZone9"]
position = Vector2(413, 317)
[node name="PS" type="Node2D" parent="Zones/PlayZone9"]
position = Vector2(209, 304)
[node name="Player" parent="." instance=ExtResource("1_65a7v")]
position = Vector2(74, 147)

View file

@ -11,7 +11,8 @@ public partial class Boss : CharacterBody2D
public enum State
{
Default,
Injured
Injured,
Killed
}
private AnimatedSprite2D _sprite;
@ -45,8 +46,10 @@ public partial class Boss : CharacterBody2D
_state = State.Default;
}
break;
case State.Killed:
break;
}
if (_currentHp <= 0)
if (_state != State.Killed && _currentHp <= 0)
{
EmitSignal(SignalName.Killed);
}
@ -55,6 +58,9 @@ public partial class Boss : CharacterBody2D
private void _OnAttack(Node2D body)
{
if (_state == State.Killed)
return;
if (body is LivingArmor armor)
{
_currentHp -= 1;

View file

@ -82,7 +82,7 @@ public partial class Claw : CharacterBody2D
_isPlayerNearBy = false;
}
public void Enable()
public void Enable(Node2D body)
{
GD.Print("Boss enabled");
_state = State.Moving;

28
scripts/entities/And.cs Normal file
View file

@ -0,0 +1,28 @@
using Godot;
using System;
public partial class And : Node
{
[Export] public int CountOfButtons = 2;
[Signal]
public delegate void ConditionMetEventHandler();
[Signal]
public delegate void ConditionNotMetEventHandler();
private int _buttons = 0;
public void Increment()
{
_buttons++;
if (_buttons == CountOfButtons)
EmitSignal(SignalName.ConditionNotMet);
}
public void Decrement()
{
_buttons--;
if (_buttons != CountOfButtons)
EmitSignal(SignalName.ConditionNotMet);
}
}