PirateTreasureHunt/scenes/TestScenes/PlayerCoin.gd

31 lines
714 B
GDScript
Raw Normal View History

2022-08-02 16:26:23 +02:00
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var player = $PlayerChar
onready var coin = $Coin
# Called when the node enters the scene tree for the first time.
func _ready():
print (player)
print (coin)
func _unhandled_input(event):
if event is InputEventMouseButton:
# var input_tile = Globals.HexGrid.get_hex_center(Globals.ScreenToHex(mouse_pos, WorldCamera))
# Move main character
if event.pressed and event.button_index == BUTTON_LEFT:
player.target = event.position
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_PlayerChar_coin_collected():
print ("Coin Collected!")