mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-13 14:02:23 +02:00
Temp card fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
var usedCards = [cards.BARREL,cards.BEAR,cards.EMPTY,cards.EMPTY,cards.EMPTY]
|
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 {
|
enum cards {
|
||||||
BANANA,
|
BANANA,
|
||||||
@@ -16,33 +16,40 @@ enum cards {
|
|||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
update_cards()
|
update_cards()
|
||||||
pass
|
|
||||||
|
|
||||||
export var ObjectParent:NodePath
|
export var ObjectParent:NodePath
|
||||||
|
|
||||||
func update_cards():
|
func update_cards():
|
||||||
for child in HBox.get_children():
|
var index = 0
|
||||||
child.queue_free()
|
while index < 5 and usedCards[index] != cards.EMPTY:
|
||||||
|
index += 1
|
||||||
for card in usedCards:
|
|
||||||
var newchild
|
for card in range(index + 1):
|
||||||
match card:
|
var newchild = []
|
||||||
|
match usedCards[card]:
|
||||||
cards.BANANA:
|
cards.BANANA:
|
||||||
newchild=load("res://Objects/Banana/BananaCard.tscn").instance()
|
newchild.append(load("res://Objects/Banana/BananaCard.tscn").instance())
|
||||||
cards.BARRIERE:
|
cards.BARRIERE:
|
||||||
newchild=(load("res://Objects/Barriere/BarrierCard.tscn").instance())
|
newchild.append(load("res://Objects/Barriere/BarrierCard.tscn").instance())
|
||||||
cards.BARREL:
|
cards.BARREL:
|
||||||
newchild=(load("res://Objects/Barrel/BarrelCard.tscn").instance())
|
newchild.append(load("res://Objects/Barrel/BarrelCard.tscn").instance())
|
||||||
cards.TORCH:
|
cards.TORCH:
|
||||||
newchild=(load("res://Objects/Torch/TorchCard.tscn").instance())
|
newchild.append(load("res://Objects/Torch/TorchCard.tscn").instance())
|
||||||
cards.BEAR:
|
cards.BEAR:
|
||||||
newchild=(load("res://Objects/Traps/Bear/BearCard.tscn").instance())
|
newchild.append(load("res://Objects/Traps/Bear/BearCard.tscn").instance())
|
||||||
cards.FLAME:
|
cards.FLAME:
|
||||||
newchild=(load("res://Objects/Traps/Flame/FlameCard.tscn").instance())
|
newchild.append(load("res://Objects/Traps/Flame/FlameCard.tscn").instance())
|
||||||
cards.SPIKE:
|
cards.SPIKE:
|
||||||
newchild=(load("res://Objects/Traps/Spike/SpikeCard.tscn").instance())
|
newchild.append(load("res://Objects/Traps/Spike/SpikeCard.tscn").instance())
|
||||||
#cards.SLIME:
|
#cards.SLIME:
|
||||||
#newchild=(load("res://Objects/Slime/SlimeCard.tscn").instance())
|
#newchild=(load("res://Objects/Slime/SlimeCard.tscn").instance())
|
||||||
if(newchild!=null):
|
for i in range(index + 1):
|
||||||
HBox.add_child(newchild)
|
$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://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]
|
[ext_resource path="res://Menus/DragNDrop/DragNDropUI.gd" type="Script" id=8]
|
||||||
|
|
||||||
[node name="DragNDropUI" type="Control"]
|
[node name="DragNDropUI" type="Control"]
|
||||||
@@ -21,18 +20,4 @@ margin_left = 2.0
|
|||||||
margin_right = 0.0400085
|
margin_right = 0.0400085
|
||||||
margin_bottom = -30.9
|
margin_bottom = -30.9
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="CardsDisplay" type="Node" 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
|
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ HeroTemplate = ExtResource( 1 )
|
|||||||
[node name="Background" parent="." instance=ExtResource( 7 )]
|
[node name="Background" parent="." instance=ExtResource( 7 )]
|
||||||
pause_mode = 1
|
pause_mode = 1
|
||||||
frame = 20
|
frame = 20
|
||||||
playing = false
|
|
||||||
|
|
||||||
[node name="FloorTileMap" type="TileMap" parent="."]
|
[node name="FloorTileMap" type="TileMap" parent="."]
|
||||||
pause_mode = 1
|
pause_mode = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user