-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build heal scene VFX and player healing
- Loading branch information
Showing
7 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extends TextureButton | ||
|
||
var button_has_been_pressed: bool | ||
@onready var black_overlay: TextureRect = $"../BlackOverlay" | ||
|
||
func _ready() -> void: | ||
black_overlay.modulate.a = 0 | ||
button_has_been_pressed = false | ||
|
||
func _on_pressed() -> void: | ||
var tween_to_black: Tween = get_tree().create_tween() | ||
# turn screen black | ||
tween_to_black.tween_property(black_overlay, "modulate:a", 1, 2) | ||
var player_health_comp: HealthComponent = PlayerManager.player.get_health_component() | ||
var max_health: int = player_health_comp.max_health | ||
var heal_amount: int = ceil(max_health * 0.25) | ||
|
||
# wait for screen to be black before healing | ||
await tween_to_black.finished | ||
player_health_comp.heal(heal_amount, null) | ||
# wait a bit | ||
await get_tree().create_timer(2).timeout | ||
|
||
var tween_to_clear: Tween = get_tree().create_tween() | ||
# remove black screen | ||
tween_to_clear.tween_property(black_overlay, "modulate:a", 0, 3) | ||
PlayerManager.player_room.room_event.on_event_ended() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
extends Control | ||
|
||
# If you are searching for the actual logic of the event, look at the script for the button | ||
func _ready() -> void: | ||
AudioManager.start_music(GlobalEnums.MusicTrack.HEAL) | ||
SaveManager.execute_save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[gd_scene load_steps=6 format=3 uid="uid://dfgne15xrjxj5"] | ||
|
||
[ext_resource type="Script" path="res://Entity/Player/Player.gd" id="1_hhmvh"] | ||
[ext_resource type="Script" path="res://Entity/Components/StatComponent.gd" id="2_4y02h"] | ||
[ext_resource type="Script" path="res://Entity/Components/StatusComponent.gd" id="3_2wp1t"] | ||
[ext_resource type="Script" path="res://Entity/Components/HealthComponent.gd" id="4_kof7q"] | ||
[ext_resource type="Script" path="res://Entity/Components/PartyComponent.gd" id="8_4i7ll"] | ||
|
||
[node name="Player_no_display" type="Node2D"] | ||
script = ExtResource("1_hhmvh") | ||
|
||
[node name="StatComponent" type="Node" parent="."] | ||
script = ExtResource("2_4y02h") | ||
|
||
[node name="StatusComponent" type="Node" parent="."] | ||
script = ExtResource("3_2wp1t") | ||
|
||
[node name="HealthComponent" type="Node" parent="."] | ||
script = ExtResource("4_kof7q") | ||
|
||
[node name="PartyComponent" type="Node" parent="."] | ||
script = ExtResource("8_4i7ll") | ||
team = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters