extends Area2D class_name Teleporter export(float) var newscale:float = 1 export(NodePath) var goto:NodePath export(String) var add_group:String = "" # group to add the teleported prey to export(String) var remove_group:String = "" # group to remove the teleported prey from export(bool) var make_grab:bool = false # set prey grabbable to this when tp export(bool) var drop:bool = false # use global drop var instead export var tint:Color = Color.white # tint you this export var tint_you:bool = false # tint you? export var rotate_you:float = 0 export var shoot_you:Vector2 = Vector2.ZERO # Called when the node enters the scene tree for the first time. func _ready(): connect("body_entered",self,"entered") #print_debug(goto) if drop: newscale /= Global.collectscale func entered(body:CollisionObject2D): if body is Prey: # or not body.grabbed: body.ungrab() body.position = get_node(goto).global_position body.spawn = get_node(goto).global_position body.scale *= Vector2(newscale,newscale) if not add_group.empty(): body.add_to_group(add_group) if not remove_group.empty(): body.remove_from_group(remove_group) body.input_pickable = make_grab body.grab.input_pickable = make_grab if tint_you: body.modulate = tint body.rotate(deg2rad(rotate_you)) body.velocity = shoot_you #* body.scale