extends Area2D

export var coin_value = 1

var original_y = 0.0

func _ready():
	original_y = position.y
	if has_node("AnimationPlayer"):
		get_node("AnimationPlayer").play("Sine")
	

# warning-ignore:unused_argument
func _physics_process(delta):
	
	var collect = false
	for obj in get_overlapping_bodies():
		if (obj.is_in_group("Player")): collect = true
	if collect: collect()


func collect():
	
	Game.coins = Game.coins + (coin_value * Game.coin_multiplication)
	if coin_value == 1:
		Audio.play_sfx("coin")
	else:
		Audio.play_sfx("diamond")
	#MemoryCard.add_coins(1)
	self.queue_free()
