31 lines
714 B
GDScript
31 lines
714 B
GDScript
|
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!")
|