Bug fixes: stuck ball, missing backgrounds in editor
This commit is contained in:
@@ -7,13 +7,13 @@ func update_background_list() -> void:
|
||||
clear()
|
||||
var i : int = 0
|
||||
for file in DirAccess.get_files_at("res://Backgrounds"):
|
||||
if file.ends_with(".png"):
|
||||
add_item(file.left(-4), i)
|
||||
set_item_metadata(i, "res://Backgrounds/%s" % file)
|
||||
if file.ends_with(".png.import"):
|
||||
add_item(file.left(-11), i)
|
||||
set_item_metadata(i, "res://Backgrounds/%s" % file.left(-7))
|
||||
i += 1
|
||||
for file in DirAccess.get_files_at("user://Backgrounds"):
|
||||
if file.ends_with(".png"):
|
||||
add_item(file.left(-4), i)
|
||||
add_item(file.left(-11), i)
|
||||
set_item_metadata(i, "user://Backgrounds/%s" % file)
|
||||
i += 1
|
||||
|
||||
|
||||
30
Dunkanoid.gd
30
Dunkanoid.gd
@@ -46,8 +46,13 @@ func _process(delta : float) -> void:
|
||||
|
||||
if OS.has_feature("editor"):
|
||||
if Input.is_action_just_pressed("cheat"):
|
||||
for i in 10:
|
||||
add_ball()
|
||||
var upgrade = _Upgrade.instantiate()
|
||||
upgrade.position = balls[0].position
|
||||
upgrade.upgrade_collected.connect(_on_upgrade_collected)
|
||||
upgrade.set_upgrade("C", Color.BLUE)
|
||||
add_child(upgrade)
|
||||
#for i in 10:
|
||||
#add_ball()
|
||||
|
||||
if mode == MODE_EXIT:
|
||||
if $Paddle.global_position.x - ($Paddle.width / 2) <= 20:
|
||||
@@ -119,22 +124,21 @@ func new_level() -> void:
|
||||
|
||||
func _brick_destroyed(brick) -> void:
|
||||
Global.score += brick.value
|
||||
if randf() > 0.4:
|
||||
if randf() > 0.9:
|
||||
var upgrade = _Upgrade.instantiate()
|
||||
upgrade.position = brick.position
|
||||
upgrade.upgrade_collected.connect(_on_upgrade_collected)
|
||||
match randi() % 5:
|
||||
#0:
|
||||
_:
|
||||
0:
|
||||
upgrade.set_upgrade("C", Color.BLUE)
|
||||
#1:
|
||||
#upgrade.set_upgrade("T", Color.GREEN)
|
||||
#2:
|
||||
#upgrade.set_upgrade("S", Color.CYAN)
|
||||
#3:
|
||||
#upgrade.set_upgrade("E", Color.DARK_SEA_GREEN)
|
||||
#4:
|
||||
#upgrade.set_upgrade("R", Color.LIGHT_CORAL)
|
||||
1:
|
||||
upgrade.set_upgrade("T", Color.GREEN)
|
||||
2:
|
||||
upgrade.set_upgrade("S", Color.CYAN)
|
||||
3:
|
||||
upgrade.set_upgrade("E", Color.DARK_SEA_GREEN)
|
||||
4:
|
||||
upgrade.set_upgrade("R", Color.LIGHT_CORAL)
|
||||
add_child(upgrade)
|
||||
bricks.erase(brick)
|
||||
var brick_count = 0
|
||||
|
||||
11
Intro.gd
11
Intro.gd
@@ -1,6 +1,8 @@
|
||||
extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
# dump_all("res://")
|
||||
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
EventBus.update_score.connect(_on_update_score)
|
||||
EventBus.update_highscore.connect(_on_update_highscore)
|
||||
@@ -28,3 +30,12 @@ func _on_editor_pressed() -> void:
|
||||
|
||||
func _on_exit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
func dump_all(dir : String, indent : String = "") -> void:
|
||||
for file in DirAccess.get_directories_at(dir):
|
||||
print("%s%s" % [indent, file])
|
||||
dump_all("%s/%s" % [dir, file], "%s " % indent)
|
||||
|
||||
for file in DirAccess.get_files_at(dir):
|
||||
print("%s%s" % [indent, file])
|
||||
|
||||
|
||||
@@ -23,13 +23,15 @@ func hit() -> void:
|
||||
pass
|
||||
|
||||
func _switch_effect(effect : int, time : int = 0) -> void:
|
||||
if mode != PADDLE_NORMAL:
|
||||
effect_finished.emit(mode)
|
||||
if mode != effect:
|
||||
if mode != PADDLE_NORMAL:
|
||||
effect_finished.emit(mode)
|
||||
if effect != PADDLE_NORMAL:
|
||||
effect_started.emit(mode)
|
||||
|
||||
mode = effect
|
||||
if mode != PADDLE_NORMAL:
|
||||
effect_started.emit(mode)
|
||||
if time > 0:
|
||||
$EffectTimer.start(time)
|
||||
if time > 0:
|
||||
$EffectTimer.start(time)
|
||||
else:
|
||||
$EffectTimer.stop()
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter="*.json"
|
||||
include_filter="*.json, *.png"
|
||||
exclude_filter=""
|
||||
export_path="../../export/Dunkanoid.x86_64"
|
||||
encryption_include_filters=""
|
||||
|
||||
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="Dunkanoid"
|
||||
config/version="0.5.2"
|
||||
config/version="0.5.5"
|
||||
run/main_scene="res://Intro.tscn"
|
||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||
run/max_fps=30
|
||||
|
||||
Reference in New Issue
Block a user