mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-12-24 20:33:19 +01:00
Show all cards, unlimited energy
This commit is contained in:
parent
01bc31b210
commit
f0383eb393
4 changed files with 29 additions and 19 deletions
5
card.gd
5
card.gd
|
@ -96,9 +96,10 @@ func move_back():
|
|||
rotation_degrees = _home_rotation
|
||||
|
||||
func buuurn():
|
||||
queue_free()
|
||||
move_back()
|
||||
#queue_free()
|
||||
#$"..".draw_rand_card()
|
||||
$"..".arrange_cards()
|
||||
#$"..".arrange_cards()
|
||||
|
||||
func dropped_on(other):
|
||||
var full_command = ""
|
||||
|
|
|
@ -99,6 +99,7 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
visible = false
|
||||
position = Vector2( -103.288, -287.778 )
|
||||
scale = Vector2( 0.542341, 0.542341 )
|
||||
texture = ExtResource( 3 )
|
||||
|
|
41
cardgame.gd
41
cardgame.gd
|
@ -1,18 +1,6 @@
|
|||
extends Control
|
||||
|
||||
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 .',
|
||||
"arg_number": 0,
|
||||
|
@ -38,6 +26,18 @@ var cards = [
|
|||
"description": "Merge specified commit into HEAD.",
|
||||
"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',
|
||||
"arg_number": 1,
|
||||
|
@ -112,12 +112,16 @@ func draw_rand_card():
|
|||
deck.push_back(cards[0])
|
||||
deck.push_back(cards[1])
|
||||
|
||||
var new_card = preload("res://card.tscn").instance()
|
||||
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.arg_number = card.arg_number
|
||||
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)
|
||||
add_child(new_card)
|
||||
arrange_cards()
|
||||
|
@ -153,8 +157,11 @@ func arrange_cards():
|
|||
|
||||
func redraw_all_cards():
|
||||
game.energy = 5
|
||||
|
||||
for card in get_tree().get_nodes_in_group("cards"):
|
||||
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)
|
||||
|
|
|
@ -27,6 +27,7 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Energy" type="Label" parent="."]
|
||||
visible = false
|
||||
modulate = Color( 0.431373, 0.792157, 0.423529, 1 )
|
||||
margin_left = 28.2219
|
||||
margin_top = 16.6766
|
||||
|
|
Loading…
Reference in a new issue