Browse Source

bunch of fixes based on feedback, adding changelog

galo 1 year ago
parent
commit
c76bf7deef
5 changed files with 63 additions and 19 deletions
  1. 27 4
      PowerUpControl.gd
  2. 1 1
      buttonsgens.gd
  3. 14 6
      main.tscn
  4. 10 5
      ui/Area2D2.gd
  5. 11 3
      ui/TouchScreenButton.gd

+ 27 - 4
PowerUpControl.gd

@@ -1,8 +1,8 @@
 extends CanvasLayer
 
 func openmenu():
-	get_tree().paused = true
-	$Control.show()
+#	get_tree().paused = true
+	$Control2.show()
 	$Control/VSeparator/Label.text = 'Choose a power:'
 	$Control/VSeparator/ItemList.clear()
 	var array = []
@@ -14,6 +14,16 @@ func openmenu():
 		text.remove(0)
 	for x in array:
 		$Control/VSeparator/ItemList.add_item(x)
+	
+	for x in 5:
+		$Control2/VSeparator/buttons.get_child(x).id = x
+		$Control2/VSeparator/buttons.get_child(x).text = array[x]
+		var buff = 0
+		if Powerups.menbros.has(array[x]): buff = 4
+		if Powerups.corpo.has(array[x]): buff = 8
+		$Control2/VSeparator/buttons.get_child(x).collayer = buff
+		$Control2/VSeparator/buttons.get_child(x).col()
+		$Control2/VSeparator/buttons.get_child(x).posswitch = true
 
 func _on_bacteria_level_up():
 	openmenu()
@@ -44,6 +54,19 @@ func _on_ItemList_item_activated(index):
 		get_parent().get_node("bacteria")._ready()
 		print(dict2)
 		print(power)
-		get_tree().paused = false
-		$Control.hide()
+#		get_tree().paused = false
+		$Control2.hide()
+	pass # Replace with function body.
+
+var buff1 = 0
+var buff2 = 0
+
+var lock = []
+
+func _physics_process(delta):
+	print(lock)
+
+func _on_Button_button_down():
+	_on_ItemList_item_activated(buff1)
+	_on_ItemList_item_activated(buff2)
 	pass # Replace with function body.

+ 1 - 1
buttonsgens.gd

@@ -8,7 +8,7 @@ var button = preload("res://ui/Button.tscn")
 
 # Called when the node enters the scene tree for the first time.
 func _ready():
-	for i in 4:
+	for i in 5:
 		var button2 = button.instance()
 		add_child(button2)
 		button2.initpos = global_position

+ 14 - 6
main.tscn

@@ -109,6 +109,7 @@ custom_fonts/font = ExtResource( 7 )
 text = "restart"
 
 [node name="PowerUpControl" type="CanvasLayer" parent="."]
+pause_mode = 2
 script = ExtResource( 5 )
 
 [node name="Control" type="MarginContainer" parent="PowerUpControl"]
@@ -157,9 +158,9 @@ theme = SubResource( 9 )
 alignment = 1
 
 [node name="Label" type="Label" parent="PowerUpControl/Control2/VSeparator"]
-margin_top = 168.0
+margin_top = 154.0
 margin_right = 380.0
-margin_bottom = 187.0
+margin_bottom = 173.0
 custom_fonts/font = ExtResource( 7 )
 text = "Choose a power:"
 
@@ -173,9 +174,9 @@ custom_fonts/font = ExtResource( 7 )
 items = [ "Item 0", null, false, "Item 1", null, false, "Item 2", null, false, "Item 3", null, false, "Item 4", null, false ]
 
 [node name="ColorRect" type="ColorRect" parent="PowerUpControl/Control2/VSeparator"]
-margin_top = 191.0
+margin_top = 177.0
 margin_right = 380.0
-margin_bottom = 791.0
+margin_bottom = 777.0
 rect_min_size = Vector2( 0, 600 )
 color = Color( 0.886275, 0.717647, 0.556863, 1 )
 
@@ -186,7 +187,7 @@ texture = ExtResource( 11 )
 
 [node name="menbros" type="Node2D" parent="PowerUpControl/Control2/VSeparator"]
 modulate = Color( 0, 1, 0.952941, 1 )
-position = Vector2( 186, 308 )
+position = Vector2( 186, 293 )
 scale = Vector2( 0.75, 0.75 )
 
 [node name="Area2D2" type="Area2D" parent="PowerUpControl/Control2/VSeparator/menbros"]
@@ -261,7 +262,7 @@ shape = SubResource( 11 )
 
 [node name="corpo" type="Node2D" parent="PowerUpControl/Control2/VSeparator"]
 modulate = Color( 1, 0.494118, 0, 1 )
-position = Vector2( 186, 308 )
+position = Vector2( 186, 293 )
 scale = Vector2( 0.75, 0.75 )
 
 [node name="Area2D8" type="Area2D" parent="PowerUpControl/Control2/VSeparator/corpo"]
@@ -327,6 +328,12 @@ shape = SubResource( 11 )
 position = Vector2( 24, 422 )
 script = ExtResource( 8 )
 
+[node name="Button" type="Button" parent="PowerUpControl/Control2/VSeparator"]
+margin_top = 781.0
+margin_right = 380.0
+margin_bottom = 806.0
+text = "accept"
+
 [node name="CanvasLayer" type="CanvasLayer" parent="."]
 layer = -1
 
@@ -341,3 +348,4 @@ theme = SubResource( 9 )
 [connection signal="button_down" from="restarter/MarginContainer/VBoxContainer/Button" to="restarter" method="_on_Button_button_down"]
 [connection signal="item_activated" from="PowerUpControl/Control/VSeparator/ItemList" to="PowerUpControl" method="_on_ItemList_item_activated"]
 [connection signal="item_activated" from="PowerUpControl/Control2/VSeparator/ItemList" to="PowerUpControl" method="_on_ItemList_item_activated"]
+[connection signal="button_down" from="PowerUpControl/Control2/VSeparator/Button" to="PowerUpControl" method="_on_Button_button_down"]

+ 10 - 5
ui/Area2D2.gd

@@ -11,11 +11,15 @@ func _ready():
 	add_child(sprite)
 
 func _on_Area2D2_area_entered(area):
-	print()
-	print(str(id) + ' ' + area.get_parent().name + ' ' + get_parent().name)
-	modulate = Color(0.5,0.5,0.5)
-	area.get_parent().posswitch = false
-	area.get_parent().initpos2 = global_position
+	if get_node('../../../..').lock == []:
+		print()
+		print(str(id) + ' ' + area.get_parent().name + ' ' + get_parent().name)
+		get_node('../../../..').buff1 = (area.get_parent().id)
+		get_node('../../../..').buff2 = (id)
+		modulate = Color(0.5,0.5,0.5)
+		area.get_parent().posswitch = false
+		area.get_parent().initpos2 = global_position
+		get_node('../../../..').lock.append(self)
 	pass # Replace with function body.
 
 
@@ -23,4 +27,5 @@ func _on_Area2D2_area_exited(area):
 	modulate = Color(1.0,1.0,1.0)
 	area.get_parent().posswitch = true
 	area.get_parent().initpos2 = global_position
+	get_node('../../../..').lock.erase(self)
 	pass # Replace with function body.

+ 11 - 3
ui/TouchScreenButton.gd

@@ -3,16 +3,24 @@ extends TouchScreenButton
 onready var initpos = global_position
 onready var initpos2 = global_position
 var posswitch = true
+var text = ''
+var id = 0
 
-export var collayer = 4
-
-func _physics_process(delta):
+var collayer = 4
+func col():
+	print(collayer)
 	$col.collision_layer = collayer
 	$col.collision_mask = collayer
+
+
+func _physics_process(delta):
+	$Label.text = text
 	$Label.show()
 	global_position = initpos if posswitch else initpos2
 	if not posswitch: $Label.hide()
+#	$col/CollisionShape2D.call_deferred('set_disabled', false)
 	if is_pressed(): 
+#		$col/CollisionShape2D.call_deferred('set_disabled', true)
 		$Label.hide()
 		global_position = get_global_mouse_position()