Completely refractor the project so the code isn't so terrible #7

Merged
CactiChameleon9 merged 39 commits from card-rework into main 2022-08-24 09:51:59 +01:00
4 changed files with 17 additions and 3 deletions
Showing only changes of commit a7256d56ed - Show all commits

View File

@ -11,7 +11,8 @@ func _process(_delta):
func the_pausing():
# iterate through the children, allowing only the current active node to run
for i in len(get_children()):
get_child(i).pause_mode = 0 if i == current_active else 1
if get_child(i).has_signal("scene_finished"): # only change if active var should exist
get_child(i).active = true if i == current_active else false
func the_connecting():
@ -23,7 +24,7 @@ func the_connecting():
if (get_child(i).has_signal("scene_finished") and
get_child(i).get_signal_connection_list("scene_finished") == []):
get_child(i).connect("scene_finished", self, child_finished())
get_child(i).connect("scene_finished", self, "child_finished")
# connect the failed signal if it exists and
@ -31,7 +32,7 @@ func the_connecting():
if (get_child(i).has_signal("scene_failed") and
get_child(i).get_signal_connection_list("scene_failed") == []):
get_child(i).connect("scene_failed", self, child_failed())
get_child(i).connect("scene_failed", self, "child_failed")
func child_finished():

View File

@ -3,6 +3,7 @@ extends Node2D
signal scene_finished
signal scene_failed
var active : bool = false
var character = null setget new_character
var movement_queue = []
@ -78,5 +79,8 @@ func character_movement():
func _physics_process(_delta):
if not active:
return
character_movement()
character_movement_input()

View File

@ -1,5 +1,10 @@
extends Control
signal scene_finished
signal scene_failed
var active : bool = false
const card_view_scene = preload("res://UI/CardView.tscn")
var character : Character = Character.new() setget update_cards_shown

View File

@ -1,6 +1,10 @@
extends Control
signal dice_selected (dice_value)
signal scene_finished
signal scene_failed
var active : bool = false
const dice = preload("res://UI/Dice.tscn")