diff --git a/Cutscenes/prototype_reed_defeated_normal.tres b/Cutscenes/prototype_reed_defeated_normal_melee.tres similarity index 100% rename from Cutscenes/prototype_reed_defeated_normal.tres rename to Cutscenes/prototype_reed_defeated_normal_melee.tres diff --git a/Cutscenes/prototype_reed_defeated_normal_range.tres b/Cutscenes/prototype_reed_defeated_normal_range.tres new file mode 100644 index 0000000..f801c73 --- /dev/null +++ b/Cutscenes/prototype_reed_defeated_normal_range.tres @@ -0,0 +1,42 @@ +[gd_resource type="Resource" script_class="Cutscene" load_steps=8 format=3 uid="uid://b5a2tteo2j2cq"] + +[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/wait.gd" id="1_u2p72"] +[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/show_dialogue.gd" id="2_hc28m"] +[ext_resource type="Script" path="res://Scripts/Cutscenes/cutscene.gd" id="3_vxdst"] + +[sub_resource type="Resource" id="Resource_j0qrl"] +script = ExtResource("1_u2p72") +time = 2.01667 + +[sub_resource type="Resource" id="Resource_o1ssy"] +script = ExtResource("2_hc28m") +character = 0 +custom_name = "" +portrait_set = "default" +portrait_emotion = "normal" +messages = Array[String](["DEFEATED_SFW_RANGE_ATTACK"]) +textbox_direction = 0 + +[sub_resource type="Resource" id="Resource_7atw7"] +script = ExtResource("2_hc28m") +character = 1 +custom_name = "" +portrait_set = "default" +portrait_emotion = "normal" +messages = Array[String](["Already? Come on, Hiro. I thought you were stronger than that."]) +textbox_direction = 1 + +[sub_resource type="Resource" id="Resource_cw5jl"] +script = ExtResource("2_hc28m") +character = 2 +custom_name = "" +portrait_set = "default" +portrait_emotion = "normal" +messages = Array[String](["Ladies and gentlemen, we have a a winner!!", "Everyone give a round of aplause for Hiro!"]) +textbox_direction = 1 + +[resource] +resource_name = "reed_wins_sfw_range" +script = ExtResource("3_vxdst") +commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_j0qrl"), SubResource("Resource_o1ssy"), SubResource("Resource_7atw7"), SubResource("Resource_cw5jl")]) +auto_start_on_load = true diff --git a/Cutscenes/prototype_reed_defeated_nsfw.tres b/Cutscenes/prototype_reed_defeated_nsfw_melee.tres similarity index 100% rename from Cutscenes/prototype_reed_defeated_nsfw.tres rename to Cutscenes/prototype_reed_defeated_nsfw_melee.tres diff --git a/Cutscenes/prototype_reed_defeated_nsfw_range.tres b/Cutscenes/prototype_reed_defeated_nsfw_range.tres new file mode 100644 index 0000000..53b7782 --- /dev/null +++ b/Cutscenes/prototype_reed_defeated_nsfw_range.tres @@ -0,0 +1,51 @@ +[gd_resource type="Resource" script_class="Cutscene" load_steps=9 format=3 uid="uid://un8ohl1ep2j6"] + +[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/wait.gd" id="1_m1fw4"] +[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/show_dialogue.gd" id="2_fxrwb"] +[ext_resource type="Script" path="res://Scripts/Cutscenes/cutscene.gd" id="3_jryou"] + +[sub_resource type="Resource" id="Resource_j0qrl"] +script = ExtResource("1_m1fw4") +time = 2.01667 + +[sub_resource type="Resource" id="Resource_75mgm"] +script = ExtResource("2_fxrwb") +character = 0 +custom_name = "" +portrait_set = "naked" +portrait_emotion = "embarrased" +messages = Array[String](["DEFEATED_NSFW_RANGE_ATTACK"]) +textbox_direction = 0 + +[sub_resource type="Resource" id="Resource_1wi5v"] +script = ExtResource("2_fxrwb") +character = 1 +custom_name = "" +portrait_set = "default" +portrait_emotion = "normal" +messages = Array[String](["Oops. Guess I overdid it."]) +textbox_direction = 1 + +[sub_resource type="Resource" id="Resource_2fi0d"] +script = ExtResource("2_fxrwb") +character = 0 +custom_name = "" +portrait_set = "naked" +portrait_emotion = "embarrased" +messages = Array[String](["Aaargh! I hate being naked in front of a crowd!!"]) +textbox_direction = 0 + +[sub_resource type="Resource" id="Resource_cw5jl"] +script = ExtResource("2_fxrwb") +character = 2 +custom_name = "" +portrait_set = "default" +portrait_emotion = "normal" +messages = Array[String](["Uh... Ladies and gentlemen... We have a winner!", "The winner is Reed!"]) +textbox_direction = 1 + +[resource] +resource_name = "reed_wins_nsfw_range" +script = ExtResource("3_jryou") +commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_j0qrl"), SubResource("Resource_75mgm"), SubResource("Resource_1wi5v"), SubResource("Resource_2fi0d"), SubResource("Resource_cw5jl")]) +auto_start_on_load = true diff --git a/Scripts/Characters/base.gd b/Scripts/Characters/base.gd index 6a021a5..9d9bb81 100644 --- a/Scripts/Characters/base.gd +++ b/Scripts/Characters/base.gd @@ -16,9 +16,9 @@ class_name CharacterBase @export var has_nsfw_animations = false signal attacked -signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2) +signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2, attack_type: Util.AttackType) signal got_hurt(new_health: int) -signal defeated +signal defeated(attack_type: Util.AttackType) # Related nodes @onready var anim_tree: AnimationTree = $AnimationTree @@ -53,7 +53,7 @@ func _process(_delta): func _on_animation_tree_animation_finished(anim_name): pass -func _on_enemy_attack_did_hit(other: Area2D, power: int, attack_direction: Vector2): +func _on_enemy_attack_did_hit(other: Area2D, power: int, attack_direction: Vector2, attack_type: Util.AttackType): pass func _on_attackbox_area_entered(area: Area2D): diff --git a/Scripts/Levels/arena_level.gd b/Scripts/Levels/arena_level.gd index 60e9126..3327f86 100644 --- a/Scripts/Levels/arena_level.gd +++ b/Scripts/Levels/arena_level.gd @@ -25,7 +25,7 @@ func _ready(): if cutscene_manager.cutscene != null and cutscene_manager.cutscene.auto_start_on_load: cutscene_manager.step() -func _on_player_defeated(): +func _on_player_defeated(by_what: Util.AttackType): if stage == 1: cutscene_manager.load_cutscene(load("res://Cutscenes/prototype_clone_defeated.tres")) elif stage == 2: @@ -34,7 +34,12 @@ func _on_player_defeated(): explosion_generator.spawn(player.position) var variation = "nsfw" if Globals.nsfw else "normal" var outcome = "defeated" if reed_ai.health > 0 else "draw" - var cutscene = "res://Cutscenes/prototype_reed_{0}_{1}.tres".format([outcome, variation]) + var cutscene: String + if outcome == "draw": + cutscene = "res://Cutscenes/prototype_reed_{0}_{1}.tres".format([outcome, variation]) + else: + var what_defeated = "range" if by_what == Util.AttackType.range else "melee" + cutscene = "res://Cutscenes/prototype_reed_{0}_{1}_{2}.tres".format([outcome, variation, what_defeated]) cutscene_manager.load_cutscene(load(cutscene)) func _on_cutscene_started(_cutscene_name): diff --git a/Scripts/hiro_ai.gd b/Scripts/hiro_ai.gd index 2478454..439ba2f 100644 --- a/Scripts/hiro_ai.gd +++ b/Scripts/hiro_ai.gd @@ -104,9 +104,9 @@ func spawn_projectile(direction: Vector2): func _physics_process(delta: float): super._physics_process(delta) -func _on_player_attack_did_hit(other, attack_power: int, attack_direction: Vector2): +func _on_enemy_attack_did_hit(other: Area2D, power: int, attack_direction: Vector2, attack_type: Util.AttackType): if other.get_parent().get_instance_id() == get_instance_id() : - _on_ai_got_hurt(attack_power, attack_direction) + _on_ai_got_hurt(power, attack_direction) func set_ai_process_mode(mode: ProcessMode): state_machine.process_mode = mode @@ -284,7 +284,7 @@ func _on_melee_state_exited(): anim_tree.set("parameters/conditions/melee", false) func _on_attackbox_area_entered(area): - attack_did_hit.emit(area, attack_power, anim_tree.get("parameters/melee/0/blend_position")) + attack_did_hit.emit(area, attack_power, anim_tree.get("parameters/melee/0/blend_position"), Util.AttackType.melee) func _on_victory_state_entered(): wants_to_melee = false diff --git a/Scripts/hiro_player.gd b/Scripts/hiro_player.gd index bd5a904..ad0682f 100644 --- a/Scripts/hiro_player.gd +++ b/Scripts/hiro_player.gd @@ -82,9 +82,9 @@ func get_input(): func _on_attackbox_area_entered(area: Area2D): var attack_vector: Vector2 = anim_tree.get("parameters/melee/0/blend_position") - attack_did_hit.emit(area, 15, attack_vector) + attack_did_hit.emit(area, 15, attack_vector, Util.AttackType.melee) -func _on_enemy_attack_did_hit(other, power, attack_direction): +func _on_enemy_attack_did_hit(other: Area2D, power: int, attack_direction: Vector2, attack_type: Util.AttackType): if other.get_parent().get_instance_id() == get_instance_id() : attack_hitbox_collider.set_deferred("disabled", true) health = health - power @@ -94,7 +94,7 @@ func _on_enemy_attack_did_hit(other, power, attack_direction): anim_playback.travel("nsfw_defeated_start") else: anim_playback.travel("defeated") - defeated.emit() + defeated.emit(attack_type) velocity = Vector2.ZERO else: var facing_direction = attack_direction * -1.0 diff --git a/Scripts/linear_projectile.gd b/Scripts/linear_projectile.gd index 89cc056..7a1a836 100644 --- a/Scripts/linear_projectile.gd +++ b/Scripts/linear_projectile.gd @@ -8,7 +8,7 @@ var power: int @onready var collision = $Collision/CollisionShape2D @onready var timer = $Timer -signal collided_with_area(other: Area2D, power: int, direction: Vector2) +signal collided_with_area(other: Area2D, power: int, direction: Vector2, attack_type: Util.AttackType) func _ready(): flip_h = sign(direction.x) < 0 @@ -24,7 +24,7 @@ func _physics_process(delta: float): func _on_collision_area_entered(area): _boom() - collided_with_area.emit(area, power, direction) + collided_with_area.emit(area, power, direction, Util.AttackType.range) func _on_timeout(): queue_free() diff --git a/Scripts/util.gd b/Scripts/util.gd index a9f8d1b..9f0ec50 100644 --- a/Scripts/util.gd +++ b/Scripts/util.gd @@ -15,3 +15,8 @@ enum CardinalDirection { South, East } + +enum AttackType { + melee, + range +} diff --git a/world/world.tscn b/world/world.tscn index 1b39d5c..00f7a1c 100644 --- a/world/world.tscn +++ b/world/world.tscn @@ -461,8 +461,8 @@ polygon = PackedVector2Array(-84, -31, -76, -57, -43, -71, -84, -71) [connection signal="given_way" from="Fades/Control/Credits" to="Fades/Control/Credits" method="_on_given_way" flags=6] [connection signal="given_way" from="Fades/Control/Credits" to="SoundManager" method="_on_game_pause_toggled" flags=6 binds= [false]] [connection signal="reward_requested" from="Fades/Control/Credits" to="." method="_on_credits_requested_reward" flags=6] -[connection signal="attack_did_hit" from="HiroPlayer" to="ShadowClone" method="_on_player_attack_did_hit"] -[connection signal="attack_did_hit" from="HiroPlayer" to="ReedAI" method="_on_player_attack_did_hit"] +[connection signal="attack_did_hit" from="HiroPlayer" to="ShadowClone" method="_on_enemy_attack_did_hit"] +[connection signal="attack_did_hit" from="HiroPlayer" to="ReedAI" method="_on_enemy_attack_did_hit"] [connection signal="attacked" from="HiroPlayer" to="SoundManager" method="_on_humanoid_character_attacked"] [connection signal="defeated" from="HiroPlayer" to="." method="_on_player_defeated" flags=6] [connection signal="defeated" from="HiroPlayer" to="ShadowClone" method="_on_player_been_defeated"]