Compare commits

..

No commits in common. "34e5e4560eb448bcb4dbd024cb86b471afa373b2" and "d8acddeaeaf5c50b58d6ba826e696b23fc32678e" have entirely different histories.

5 changed files with 2 additions and 146 deletions

View File

@ -3,11 +3,8 @@ extends Node2D
@onready var _timer_label: Label = $CanvasLayer/TimerLabel @onready var _timer_label: Label = $CanvasLayer/TimerLabel
@onready var _spawn_control = $SpawnControl @onready var _spawn_control = $SpawnControl
var _debug_menu_script = preload("res://scripts/debug_menu.gd")
func _ready(): func _ready():
MusicManager.play(preload("res://assets/music&sfx/music/ashveil-355633.mp3")) MusicManager.play(preload("res://assets/music&sfx/music/ashveil-355633.mp3"))
add_child(_debug_menu_script.new())
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
var t = int(_spawn_control.elapsed_time) var t = int(_spawn_control.elapsed_time)

View File

@ -62,5 +62,3 @@ func collect():
var scale_tween = create_tween() var scale_tween = create_tween()
collected.emit(self) collected.emit(self)
scale_tween.tween_property(self, "scale", Vector2.ZERO,0.2) scale_tween.tween_property(self, "scale", Vector2.ZERO,0.2)
await scale_tween.finished
queue_free()

View File

@ -1,118 +0,0 @@
extends CanvasLayer
@onready var _spawn_control = get_node("/root/Game/SpawnControl")
@onready var _witch = get_node("/root/Game/Witch")
@onready var _drop_manager = get_node("/root/Game/DropManager")
var _spell_dispatch: Dictionary
var _lvl_disable_btn: Button
func _ready() -> void:
layer = 10
_spell_dispatch = {
SpellLibrary.FIREBALL: _witch.shoot_fireballs,
SpellLibrary.SHURIKEN: _witch.shoot_shuriken,
SpellLibrary.FIRE_SWIRL: _witch.shoot_fire_swirl,
SpellLibrary.TORNADO: _witch.shoot_tornado,
}
_build_ui()
hide()
func _exit_tree() -> void:
Engine.time_scale = 1.0
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed and not event.echo:
if event.keycode == KEY_D and event.ctrl_pressed:
visible = not visible
get_viewport().set_input_as_handled()
func _build_ui() -> void:
var panel := PanelContainer.new()
var style := StyleBoxFlat.new()
style.bg_color = Color(0.0, 0.0, 0.0, 0.75)
panel.add_theme_stylebox_override("panel", style)
panel.anchor_left = 1.0
panel.anchor_right = 1.0
panel.anchor_top = 0.0
panel.anchor_bottom = 1.0
panel.offset_left = -220
panel.offset_right = 0
add_child(panel)
var scroll := ScrollContainer.new()
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
panel.add_child(scroll)
var vbox := VBoxContainer.new()
vbox.custom_minimum_size = Vector2(210, 0)
vbox.add_theme_constant_override("separation", 4)
scroll.add_child(vbox)
_add_section(vbox, "ENEMIES")
_add_button(vbox, "Kill All", _kill_all_enemies)
_add_section(vbox, "TIME SCALE")
var hbox_scale := HBoxContainer.new()
vbox.add_child(hbox_scale)
for s in [1, 2, 5, 10]:
var btn := Button.new()
btn.text = "%dx" % s
btn.size_flags_horizontal = Control.SIZE_EXPAND_FILL
btn.pressed.connect(_set_time_scale.bind(float(s)))
hbox_scale.add_child(btn)
_add_section(vbox, "SKIP TIME")
var hbox_time := HBoxContainer.new()
vbox.add_child(hbox_time)
for secs in [30, 60]:
var btn := Button.new()
btn.text = "+%ds" % secs
btn.size_flags_horizontal = Control.SIZE_EXPAND_FILL
btn.pressed.connect(_skip_time.bind(float(secs)))
hbox_time.add_child(btn)
_add_section(vbox, "SPELLS")
for spell_id in SpellLibrary.recipes.keys():
if _spell_dispatch.has(spell_id):
_add_button(vbox, spell_id.capitalize(), _spell_dispatch[spell_id])
_add_section(vbox, "LEVEL")
_add_button(vbox, "Level Up", _force_level_up)
_lvl_disable_btn = Button.new()
_lvl_disable_btn.text = "Disable Level Up: OFF"
_lvl_disable_btn.size_flags_horizontal = Control.SIZE_EXPAND_FILL
_lvl_disable_btn.pressed.connect(_toggle_level_up_disabled)
vbox.add_child(_lvl_disable_btn)
func _add_section(parent: VBoxContainer, title: String) -> void:
var label := Label.new()
label.text = title
label.add_theme_color_override("font_color", Color.YELLOW)
label.add_theme_font_size_override("font_size", 11)
parent.add_child(label)
func _add_button(parent: VBoxContainer, label: String, callback: Callable) -> void:
var btn := Button.new()
btn.text = label
btn.size_flags_horizontal = Control.SIZE_EXPAND_FILL
btn.pressed.connect(callback)
parent.add_child(btn)
func _kill_all_enemies() -> void:
for enemy in get_tree().get_nodes_in_group("enemies"):
if is_instance_valid(enemy):
enemy.die()
func _set_time_scale(scale: float) -> void:
Engine.time_scale = scale
func _skip_time(secs: float) -> void:
_spawn_control.elapsed_time += secs
func _force_level_up() -> void:
_drop_manager.force_level_up()
func _toggle_level_up_disabled() -> void:
_drop_manager.level_up_disabled = not _drop_manager.level_up_disabled
_lvl_disable_btn.text = "Disable Level Up: " + ("ON" if _drop_manager.level_up_disabled else "OFF")

View File

@ -1 +0,0 @@
uid://0r76ifdlnlv

View File

@ -3,13 +3,9 @@ extends Node2D
@onready var player = get_node("/root/Game/Player") @onready var player = get_node("/root/Game/Player")
@onready var bar = get_node("/root/Game/CanvasLayer/ProgressBar") @onready var bar = get_node("/root/Game/CanvasLayer/ProgressBar")
signal leveled_up signal leveled_up
@export var fruit_drop_threshold: int = 7
@export var fruit_drop_ceiling: int = 15
var level_up_disabled: bool = false # FOR DEBUG MENU
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
assert(fruit_drop_threshold <= fruit_drop_ceiling)
bar.max_value = player.max_xp bar.max_value = player.max_xp
pass # Replace with function body. pass # Replace with function body.
@ -23,7 +19,7 @@ func on_enemy_died(enemy):
var enemy_xp = enemy.xp var enemy_xp = enemy.xp
player.current_xp += enemy.xp player.current_xp += enemy.xp
bar.value = player.current_xp bar.value = player.current_xp
if player.current_xp >= player.max_xp and not level_up_disabled: if player.current_xp >= player.max_xp:
leveled_up.emit() leveled_up.emit()
player.max_xp = player.max_xp * 1.3 player.max_xp = player.max_xp * 1.3
bar.max_value = player.max_xp bar.max_value = player.max_xp
@ -36,24 +32,8 @@ func on_enemy_died(enemy):
func drop_item(enemy): func drop_item(enemy):
if not is_instance_valid(enemy): if not is_instance_valid(enemy):
return return
var fruit_count = get_children().filter(func(c): return c is DropsBase).size()
for entry in enemy.drop_table: for entry in enemy.drop_table:
var effective_chance = entry.chance if randf() < entry.chance:
if fruit_count >= fruit_drop_ceiling:
continue
elif fruit_count > fruit_drop_threshold:
var chance_scale = 1.0 - float(fruit_count - fruit_drop_threshold) / float(fruit_drop_ceiling - fruit_drop_threshold)
effective_chance *= chance_scale
if randf() < effective_chance:
var drop = entry.drop.instantiate() var drop = entry.drop.instantiate()
drop.global_position = enemy.global_position drop.global_position = enemy.global_position
add_child(drop) add_child(drop)
# FOR DEBUG MENU
func force_level_up() -> void:
leveled_up.emit()
player.max_xp = player.max_xp * 1.3
bar.max_value = player.max_xp
player.current_xp = 0
bar.value = 0
player.level += 1