disable sg2083 and pan camera over to fami when defeated

This commit is contained in:
Haze Weathers 2024-02-29 00:40:38 -05:00
parent 12d6adaf94
commit 3ff2f837d8
5 changed files with 32 additions and 4 deletions

View file

@ -33,3 +33,11 @@ func _on_cutscene_finished() -> void:
func _on_2083_energy_changed(amount) -> void: func _on_2083_energy_changed(amount) -> void:
sg_energy.value = amount sg_energy.value = amount
func _on_Famira_died() -> void:
sg2083.state = sg2083.State.INACTIVE
print("HEHE")
var tween = create_tween()
tween.set_trans(Tween.TRANS_CUBIC)
tween.tween_property($"%Camera", "global_position:x", famira.global_position.x - 128, 0.5)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=10 format=2]
[ext_resource path="res://objects/enemy/boss/sg2083.tscn" type="PackedScene" id=1] [ext_resource path="res://objects/enemy/boss/sg2083.tscn" type="PackedScene" id=1]
[ext_resource path="res://tilesets/t_laboratory.tres" type="TileSet" id=2] [ext_resource path="res://tilesets/t_laboratory.tres" type="TileSet" id=2]
@ -8,12 +8,23 @@
[ext_resource path="res://tilesets/t_station.tres" type="TileSet" id=6] [ext_resource path="res://tilesets/t_station.tres" type="TileSet" id=6]
[ext_resource path="res://cutscenes/fami_cutscene.tscn" type="PackedScene" id=7] [ext_resource path="res://cutscenes/fami_cutscene.tscn" type="PackedScene" id=7]
[ext_resource path="res://objects/lore/boss/fami.tscn" type="PackedScene" id=8] [ext_resource path="res://objects/lore/boss/fami.tscn" type="PackedScene" id=8]
[ext_resource path="res://graphics/backgrounds/fami_rooftop.png" type="Texture" id=9]
[node name="Map" type="Node2D" groups=["map"]] [node name="Map" type="Node2D" groups=["map"]]
pause_mode = 1 pause_mode = 1
script = ExtResource( 3 ) script = ExtResource( 3 )
lore_entries = [ ExtResource( 8 ) ] lore_entries = [ ExtResource( 8 ) ]
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_scale = Vector2( 0.5, 1 )
motion_offset = Vector2( -256, 0 )
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource( 9 )
centered = false
[node name="GUI" type="CanvasLayer" parent="."] [node name="GUI" type="CanvasLayer" parent="."]
[node name="Control" type="HBoxContainer" parent="GUI"] [node name="Control" type="HBoxContainer" parent="GUI"]
@ -112,13 +123,15 @@ visible = false
position = Vector2( 0, 12 ) position = Vector2( 0, 12 )
famira_path = NodePath("../Famira") famira_path = NodePath("../Famira")
[node name="Camera2D" type="Camera2D" parent="2083"] [node name="Camera" type="Camera2D" parent="2083"]
unique_name_in_owner = true
position = Vector2( 0, -4 ) position = Vector2( 0, -4 )
offset = Vector2( 0, -8 ) offset = Vector2( 0, -8 )
anchor_mode = 0 anchor_mode = 0
current = true current = true
limit_top = 8 limit_top = 8
limit_bottom = 192 limit_bottom = 192
limit_smoothed = true
[node name="Famira" parent="." instance=ExtResource( 4 )] [node name="Famira" parent="." instance=ExtResource( 4 )]
visible = false visible = false
@ -128,4 +141,5 @@ sg2083_path = NodePath("../2083")
[connection signal="cutscene_finished" from="FamiCutscene" to="." method="_on_cutscene_finished"] [connection signal="cutscene_finished" from="FamiCutscene" to="." method="_on_cutscene_finished"]
[connection signal="energy_changed" from="2083" to="." method="_on_2083_energy_changed"] [connection signal="energy_changed" from="2083" to="." method="_on_2083_energy_changed"]
[connection signal="health_changed" from="2083" to="." method="_on_2083_health_changed"] [connection signal="health_changed" from="2083" to="." method="_on_2083_health_changed"]
[connection signal="died" from="Famira" to="." method="_on_Famira_died"]
[connection signal="health_changed" from="Famira" to="." method="_on_Famira_health_changed"] [connection signal="health_changed" from="Famira" to="." method="_on_Famira_health_changed"]

View file

@ -1,6 +1,7 @@
extends Node2D extends Node2D
signal died()
signal health_changed(amount) signal health_changed(amount)
@ -45,10 +46,14 @@ func stop_push() -> void:
func hurt(amount: float) -> void: func hurt(amount: float) -> void:
if hp <= 0.0:
return
hp -= amount hp -= amount
hp = max(hp, 0.0)
emit_signal("health_changed", hp) emit_signal("health_changed", hp)
if hp <= 0.0: if hp <= 0.0:
state_chart.send_event("die") state_chart.send_event("die")
emit_signal("died")
func _attack() -> void: func _attack() -> void:

View file

@ -758,7 +758,7 @@ tracks/19/loop_wrap = true
tracks/19/imported = false tracks/19/imported = false
tracks/19/enabled = true tracks/19/enabled = true
tracks/19/keys = { tracks/19/keys = {
"times": PoolRealArray( 0, 7 ), "times": PoolRealArray( 0, 7.6 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 1 ),
"update": 1, "update": 1,
"values": [ true, false ] "values": [ true, false ]
@ -1808,6 +1808,7 @@ linear_accel = -30.19
[node name="DissolveParticles" type="CPUParticles2D" parent="."] [node name="DissolveParticles" type="CPUParticles2D" parent="."]
material = ExtResource( 17 ) material = ExtResource( 17 )
position = Vector2( 4, -8 ) position = Vector2( 4, -8 )
z_index = -20
emitting = false emitting = false
amount = 16 amount = 16
local_coords = false local_coords = false

View file

@ -65,7 +65,7 @@ func _physics_process(delta: float) -> void:
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if state == State.DEAD: if state == State.DEAD or state == State.INACTIVE:
return return
if event.is_action_pressed("shoot") and (state == State.STAND or state == State.FORWARD or state == State.BACK) and energy >= bullet_energy: if event.is_action_pressed("shoot") and (state == State.STAND or state == State.FORWARD or state == State.BACK) and energy >= bullet_energy:
shoot() shoot()