Added Card Level Animation

This commit is contained in:
2020-04-20 12:57:48 +02:00
parent 0b930fd1c6
commit 9b5ccae8a7
2 changed files with 17 additions and 3 deletions

View File

@@ -62,3 +62,5 @@ anchor_bottom = 0.87
margin_left = 2.0
margin_right = 0.0400085
margin_bottom = -30.9
[editable path="GenericCard1"]

View File

@@ -4,6 +4,8 @@ export var Item:PackedScene
export var PreviewIcon:Texture
export var DeleteOnGrab:bool = false
var card_level = 0
#if a drag is initiated here
func get_drag_data(_pos):
var ctrl = Control.new()
@@ -19,13 +21,13 @@ func get_drag_data(_pos):
return Item
#stuff can be dropped here
#eg you picked the wrong thing up, let go and it returns to nothingness
# stuff can be dropped here
# eg you picked the wrong thing up, let go and it returns to nothingness
func can_drop_data(_pos, data):
return typeof(data) == typeof(PackedScene)
#do nothing if stuff is dropped here
# do nothing if stuff is dropped here
func drop_data(_pos, _data):
pass
@@ -37,3 +39,13 @@ func get_resized_texture(t: Texture, width: int = 0, height: int = 0):
var itex = ImageTexture.new()
itex.create_from_image(image,0)
return itex
func upgrade_card():
match card_level:
0:
$AnimatedSprite.play("lvl1")
card_level += 1
1:
$AnimatedSprite.play("lvl2")
card_level += 1