-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the pause menu on player death, Changed enemy spawning mechanics
- Loading branch information
1 parent
3a591db
commit 6982084
Showing
166 changed files
with
381 additions
and
304 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
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,43 @@ | ||
extends Node | ||
|
||
func _ready(): | ||
# The path to the folder containing the .ogg files | ||
var folder_path = "res://sfx/Leaves" | ||
|
||
# Open the directory | ||
var dir = DirAccess.open(folder_path) | ||
|
||
if dir: | ||
# Begin listing files in the directory | ||
dir.list_dir_begin() | ||
var ogg_files = [] | ||
|
||
# Iterate over all files in the directory | ||
var file_name = dir.get_next() | ||
while file_name != "": | ||
ogg_files.append(file_name) | ||
file_name = dir.get_next() | ||
|
||
# End listing of files | ||
dir.list_dir_end() | ||
|
||
# Select a random .ogg file from the list | ||
if ogg_files.size() > 0: | ||
var random_index = randi() % ogg_files.size() | ||
var selected_ogg = ogg_files[random_index] | ||
|
||
print("Selected file: ", selected_ogg) | ||
|
||
# Load and play the selected .ogg file | ||
var audio_stream = load(folder_path + "/" + selected_ogg) as AudioStream | ||
print(audio_stream) | ||
if audio_stream: | ||
var audio_player = AudioStreamPlayer3D.new() # Use AudioStreamPlayer3D for 3D audio | ||
audio_player.stream = audio_stream | ||
audio_player.attenuation_model = AudioStreamPlayer3D.ATTENUATION_INVERSE_DISTANCE | ||
audio_player.max_distance = 100000.0 # Set max distance to 100000 units | ||
audio_player.unit_size = 1.0 # Default unit size | ||
audio_player.play() # Autoplay the sound | ||
add_child(audio_player) | ||
else: | ||
print("Failed to open directory: ", folder_path) |
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
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 |
---|---|---|
@@ -1,43 +1,58 @@ | ||
extends RichTextLabel | ||
|
||
var isPaused: bool = true | ||
var textCache | ||
var textCache: String | ||
@export var rectangle: ColorRect | ||
@export var animationTime: float | ||
var cachedBlack | ||
var cachedLod | ||
var LodProgress: float = 1 | ||
@export var animationTime: float = 1.0 | ||
var cachedBlack: float = 0.0 | ||
var cachedLod: float = 0.0 | ||
var LodProgress: float = 1.0 | ||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready() -> void: | ||
cachedLod = rectangle.material.get_shader_parameter("lod") | ||
cachedBlack = rectangle.material.get_shader_parameter("black") | ||
# Ensure rectangle and its material are available | ||
if rectangle and rectangle.material: | ||
reset_shader_parameters() | ||
else: | ||
print("Error: Rectangle or material is missing.") | ||
|
||
textCache = text | ||
text = "" | ||
|
||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta: float) -> void: | ||
if Input.is_action_just_pressed("ui_cancel"): | ||
isPaused = !isPaused | ||
|
||
get_tree().paused = isPaused | ||
if isPaused: | ||
animateShader(delta, true) | ||
animate_shader(delta, true) | ||
text = textCache | ||
if Input.is_action_just_pressed("Legendary Inventory"): | ||
get_tree().reload_current_scene() | ||
|
||
restart_scene() | ||
else: | ||
animateShader(delta, false) | ||
animate_shader(delta, false) | ||
text = "" | ||
|
||
func animateShader(delta: float, isIncreasing: bool): | ||
func animate_shader(delta: float, isIncreasing: bool) -> void: | ||
if isIncreasing: | ||
if LodProgress < 1: | ||
LodProgress += delta / animationTime | ||
LodProgress = min(LodProgress + delta / animationTime, 1.0) | ||
else: | ||
if LodProgress > 0: | ||
LodProgress -= delta / animationTime | ||
clampf(LodProgress, 0, 1) | ||
LodProgress = max(LodProgress - delta / animationTime, 0.0) | ||
|
||
rectangle.material.set_shader_parameter("lod", cachedLod * ease(LodProgress, 0.6)) | ||
rectangle.material.set_shader_parameter("black", lerpf(1, cachedBlack, ease(LodProgress, 0.6))) | ||
|
||
# Function to reset shader parameters and cached variables | ||
func reset_shader_parameters() -> void: | ||
if rectangle and rectangle.material: | ||
cachedLod = 2 | ||
cachedBlack = 0.3 | ||
LodProgress = 1.0 | ||
else: | ||
print("Error: Rectangle or material is missing.") | ||
|
||
# Function to handle scene restart | ||
func restart_scene() -> void: | ||
reset_shader_parameters() # Ensure cached values are reset before restarting | ||
get_tree().reload_current_scene() |
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
Oops, something went wrong.