mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-07 05:02:04 +02:00
Cards have images!
This commit is contained in:
parent
3437b89ffc
commit
9f9548abcf
23 changed files with 1820 additions and 9 deletions
|
@ -5,6 +5,7 @@ var dragged = false
|
|||
var drag_offset
|
||||
|
||||
export var arg_number = 0
|
||||
export var id = "" setget set_id
|
||||
export var command = "" setget set_command
|
||||
export var description = "" setget set_description
|
||||
export var energy = 0 setget set_energy
|
||||
|
@ -79,6 +80,12 @@ func set_energy(new_energy):
|
|||
energy = new_energy
|
||||
if energy_label:
|
||||
energy_label.text = str(energy)
|
||||
|
||||
func set_id(new_id):
|
||||
id = new_id
|
||||
var texture = load("res://cards/%s.svg" % new_id)
|
||||
if texture:
|
||||
$Image.texture = texture
|
||||
|
||||
func move_back():
|
||||
position = _home_position
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
[ext_resource path="res://sounds/swoosh.wav" type="AudioStream" id=5]
|
||||
[ext_resource path="res://sounds/poof.wav" type="AudioStream" id=6]
|
||||
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.45098, 0.584314, 0.843137, 1 )
|
||||
border_color = Color( 0.0627451, 0.141176, 0.176471, 1 )
|
||||
|
@ -66,9 +65,9 @@ shape = SubResource( 2 )
|
|||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = -89.0
|
||||
margin_top = -276.0
|
||||
margin_top = -279.0
|
||||
margin_right = 85.0
|
||||
margin_bottom = -185.0
|
||||
margin_bottom = -184.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
text = "Name"
|
||||
|
@ -79,7 +78,7 @@ __meta__ = {
|
|||
|
||||
[node name="ColorRect2" type="Panel" parent="."]
|
||||
margin_left = -97.0
|
||||
margin_top = -169.0
|
||||
margin_top = -166.0
|
||||
margin_right = 94.0
|
||||
margin_bottom = -10.0
|
||||
mouse_filter = 2
|
||||
|
@ -90,9 +89,9 @@ __meta__ = {
|
|||
|
||||
[node name="Description" type="Label" parent="."]
|
||||
margin_left = -92.0
|
||||
margin_top = -164.0
|
||||
margin_right = 133.0
|
||||
margin_bottom = 23.0
|
||||
margin_top = -160.0
|
||||
margin_right = 146.0
|
||||
margin_bottom = 31.0
|
||||
rect_scale = Vector2( 0.75, 0.75 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
@ -132,5 +131,17 @@ volume_db = -6.848
|
|||
[node name="ReturnSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 5 )
|
||||
volume_db = -6.848
|
||||
|
||||
[node name="Image" type="TextureRect" parent="."]
|
||||
margin_left = -88.0
|
||||
margin_top = -243.735
|
||||
margin_right = 85.0
|
||||
margin_bottom = -178.735
|
||||
mouse_filter = 2
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[connection signal="mouse_entered" from="Area2D" to="." method="_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="Area2D" to="." method="_mouse_exited"]
|
||||
|
|
|
@ -35,6 +35,7 @@ func draw_rand_card():
|
|||
func draw_card(card):
|
||||
var new_card = preload("res://scenes/card.tscn").instance()
|
||||
|
||||
new_card.id = card["id"]
|
||||
new_card.command = card["command"]
|
||||
new_card.arg_number = int(card["arg_number"])
|
||||
new_card.description = card["description"]
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
[ext_resource path="res://scenes/terminal.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=6]
|
||||
|
||||
|
||||
[node name="Cardgame" type="Node2D"]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
visible = false
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -172.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue