forked from team-sg/hero-mark-2
adjusted level and barrier
This commit is contained in:
parent
209884f133
commit
b2baccfa57
16 changed files with 138 additions and 46 deletions
|
@ -1,15 +1,24 @@
|
|||
extends Node2D
|
||||
|
||||
export var cost = 0
|
||||
export var label_offset = Vector2.ZERO
|
||||
onready var label = $Label
|
||||
onready var sprite = $Sprite
|
||||
onready var hitbox = $StaticBody2D/CollisionShape2D
|
||||
|
||||
func _ready():
|
||||
if scale.y != 1:
|
||||
sprite.set_region_rect(Rect2(0,0,4,scale.y))
|
||||
hitbox.scale.y = scale.y
|
||||
scale.y = 1
|
||||
#Label
|
||||
label.visible = true
|
||||
label.set_text(str(cost))
|
||||
label.rect_position.y = scale.y / 2
|
||||
|
||||
func _physics_process(delta):
|
||||
#Open
|
||||
if Game.golds >= cost: $AnimationPlayer.play("open")
|
||||
if Game.golds >= cost: queue_free()
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
if anim_name == "open":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue