Show all cards, unlimited energy

This commit is contained in:
Sebastian Morr 2020-10-15 16:11:02 +02:00
parent 01bc31b210
commit f0383eb393
4 changed files with 29 additions and 19 deletions

View file

@ -96,9 +96,10 @@ func move_back():
rotation_degrees = _home_rotation rotation_degrees = _home_rotation
func buuurn(): func buuurn():
queue_free() move_back()
#queue_free()
#$"..".draw_rand_card() #$"..".draw_rand_card()
$"..".arrange_cards() #$"..".arrange_cards()
func dropped_on(other): func dropped_on(other):
var full_command = "" var full_command = ""

View file

@ -99,6 +99,7 @@ __meta__ = {
} }
[node name="Sprite" type="Sprite" parent="."] [node name="Sprite" type="Sprite" parent="."]
visible = false
position = Vector2( -103.288, -287.778 ) position = Vector2( -103.288, -287.778 )
scale = Vector2( 0.542341, 0.542341 ) scale = Vector2( 0.542341, 0.542341 )
texture = ExtResource( 3 ) texture = ExtResource( 3 )

View file

@ -1,18 +1,6 @@
extends Control extends Control
var cards = [ var cards = [
{
"command": 'git commit --allow-empty -m "$RANDOM"',
"arg_number": 0,
"description": "Add a new commit under HEAD.",
"energy": 1
},
{
"command": 'git checkout',
"arg_number": 1,
"description": "Point HEAD to a branch or commit, and update the index and the working directory.",
"energy": 1
},
{ {
"command": 'git add .', "command": 'git add .',
"arg_number": 0, "arg_number": 0,
@ -38,6 +26,18 @@ var cards = [
"description": "Merge specified commit into HEAD.", "description": "Merge specified commit into HEAD.",
"energy": 1 "energy": 1
}, },
{
"command": 'git commit --allow-empty -m "$RANDOM"',
"arg_number": 0,
"description": "Add a new commit under HEAD.",
"energy": 1
},
{
"command": 'git checkout',
"arg_number": 1,
"description": "Point HEAD to a branch or commit, and update the index and the working directory.",
"energy": 1
},
{ {
"command": 'git update-ref -d', "command": 'git update-ref -d',
"arg_number": 1, "arg_number": 1,
@ -112,12 +112,16 @@ func draw_rand_card():
deck.push_back(cards[0]) deck.push_back(cards[0])
deck.push_back(cards[1]) deck.push_back(cards[1])
var new_card = preload("res://card.tscn").instance()
var card = deck[randi() % deck.size()] var card = deck[randi() % deck.size()]
draw_card(card)
func draw_card(card):
var new_card = preload("res://card.tscn").instance()
new_card.command = card.command new_card.command = card.command
new_card.arg_number = card.arg_number new_card.arg_number = card.arg_number
new_card.description = card.description new_card.description = card.description
new_card.energy = card.energy new_card.energy = 0 #card.energy
new_card.position = Vector2(rect_size.x, rect_size.y*2) new_card.position = Vector2(rect_size.x, rect_size.y*2)
add_child(new_card) add_child(new_card)
arrange_cards() arrange_cards()
@ -153,8 +157,11 @@ func arrange_cards():
func redraw_all_cards(): func redraw_all_cards():
game.energy = 5 game.energy = 5
for card in get_tree().get_nodes_in_group("cards"): for card in get_tree().get_nodes_in_group("cards"):
card.queue_free() card.queue_free()
for i in range(7):
draw_rand_card()
# for i in range(7):
# draw_rand_card()
for card in cards:
draw_card(card)

View file

@ -27,6 +27,7 @@ __meta__ = {
} }
[node name="Energy" type="Label" parent="."] [node name="Energy" type="Label" parent="."]
visible = false
modulate = Color( 0.431373, 0.792157, 0.423529, 1 ) modulate = Color( 0.431373, 0.792157, 0.423529, 1 )
margin_left = 28.2219 margin_left = 28.2219
margin_top = 16.6766 margin_top = 16.6766