mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-11 21:22:22 +02:00
Temp card fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
extends Control
|
||||
|
||||
var usedCards = [cards.BARREL,cards.BEAR,cards.EMPTY,cards.EMPTY,cards.EMPTY]
|
||||
onready var HBox = $HBoxContainer
|
||||
var cardPositions = [Vector2(0,150), Vector2(50,150), Vector2(100,150), Vector2(150,150), Vector2(200, 150)]
|
||||
|
||||
enum cards {
|
||||
BANANA,
|
||||
@@ -16,33 +16,40 @@ enum cards {
|
||||
|
||||
func _ready():
|
||||
update_cards()
|
||||
pass
|
||||
|
||||
export var ObjectParent:NodePath
|
||||
|
||||
func update_cards():
|
||||
for child in HBox.get_children():
|
||||
child.queue_free()
|
||||
|
||||
for card in usedCards:
|
||||
var newchild
|
||||
match card:
|
||||
var index = 0
|
||||
while index < 5 and usedCards[index] != cards.EMPTY:
|
||||
index += 1
|
||||
|
||||
for card in range(index + 1):
|
||||
var newchild = []
|
||||
match usedCards[card]:
|
||||
cards.BANANA:
|
||||
newchild=load("res://Objects/Banana/BananaCard.tscn").instance()
|
||||
newchild.append(load("res://Objects/Banana/BananaCard.tscn").instance())
|
||||
cards.BARRIERE:
|
||||
newchild=(load("res://Objects/Barriere/BarrierCard.tscn").instance())
|
||||
newchild.append(load("res://Objects/Barriere/BarrierCard.tscn").instance())
|
||||
cards.BARREL:
|
||||
newchild=(load("res://Objects/Barrel/BarrelCard.tscn").instance())
|
||||
newchild.append(load("res://Objects/Barrel/BarrelCard.tscn").instance())
|
||||
cards.TORCH:
|
||||
newchild=(load("res://Objects/Torch/TorchCard.tscn").instance())
|
||||
newchild.append(load("res://Objects/Torch/TorchCard.tscn").instance())
|
||||
cards.BEAR:
|
||||
newchild=(load("res://Objects/Traps/Bear/BearCard.tscn").instance())
|
||||
newchild.append(load("res://Objects/Traps/Bear/BearCard.tscn").instance())
|
||||
cards.FLAME:
|
||||
newchild=(load("res://Objects/Traps/Flame/FlameCard.tscn").instance())
|
||||
newchild.append(load("res://Objects/Traps/Flame/FlameCard.tscn").instance())
|
||||
cards.SPIKE:
|
||||
newchild=(load("res://Objects/Traps/Spike/SpikeCard.tscn").instance())
|
||||
newchild.append(load("res://Objects/Traps/Spike/SpikeCard.tscn").instance())
|
||||
#cards.SLIME:
|
||||
#newchild=(load("res://Objects/Slime/SlimeCard.tscn").instance())
|
||||
if(newchild!=null):
|
||||
HBox.add_child(newchild)
|
||||
for i in range(index + 1):
|
||||
$CardsDisplay.add_child(shownCards[i])
|
||||
shownCards[0].set_begin (cardPositions[0])
|
||||
shownCards[1].set_begin (cardPositions[1])
|
||||
shownCards[2].set_begin (cardPositions[2])
|
||||
|
||||
for i in range(index + 1):
|
||||
shownCards[i].canNotPlace = true
|
||||
shownCards[i].margin_bottom = shownCards[i].margin_top+32
|
||||
shownCards[i].margin_right = shownCards[i].margin_left+32
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Menus/DragNDrop/DragSink.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Objects/Traps/Flame/FlameCard.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Menus/DragNDrop/DragNDropUI.gd" type="Script" id=8]
|
||||
|
||||
[node name="DragNDropUI" type="Control"]
|
||||
@@ -21,18 +20,4 @@ margin_left = 2.0
|
||||
margin_right = 0.0400085
|
||||
margin_bottom = -30.9
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
margin_left = 17.5188
|
||||
margin_top = 220.946
|
||||
margin_right = 57.5188
|
||||
margin_bottom = 260.946
|
||||
custom_constants/separation = 60
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="FlameCard" parent="HBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_left = 0.0
|
||||
margin_top = 0.0
|
||||
margin_right = 0.0
|
||||
margin_bottom = 40.0
|
||||
[node name="CardsDisplay" type="Node" parent="."]
|
||||
|
||||
@@ -245,7 +245,6 @@ HeroTemplate = ExtResource( 1 )
|
||||
[node name="Background" parent="." instance=ExtResource( 7 )]
|
||||
pause_mode = 1
|
||||
frame = 20
|
||||
playing = false
|
||||
|
||||
[node name="FloorTileMap" type="TileMap" parent="."]
|
||||
pause_mode = 1
|
||||
|
||||
Reference in New Issue
Block a user