tochie-kit/nodes/GameObject.gd

13 lines
369 B
GDScript

tool
extends Node2D
class_name TK_GameObject
func _ready() -> void:
# It's okay to fail here for non-grid contexts.
if get_parent().connect("cell_size_changed", self, "_update_cell_size"):
pass
func _update_cell_size(p_old_cell_size: Vector2, p_new_cell_size: Vector2) -> void:
var delta := p_new_cell_size / p_old_cell_size
position *= delta