adjusted level and barrier

This commit is contained in:
pennyrigate 2022-12-19 21:08:18 -05:00
parent 209884f133
commit b2baccfa57
16 changed files with 138 additions and 46 deletions

View file

@ -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":