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