I did try a diffrent thing tonight,
i add a toucscreen button,
add this code on it:
extends TouchScreenButton
onready var target_drag_pos = get_parent().get_node("meteor_target")
onready var meteor_magic_circle_sprite = preload("res://sahneler/magic_circle_sprite.tscn")
var target
var skill_pressed = false
func _on_meteor_call_skill_pressed():
skill_pressed = true
target = meteor_magic_circle_sprite.instance()
add_child(target)
target.transform.origin = Vector3(0,1,0)
print ("button pressed")
everyting is good, i got instanced magic circle that as vector3.
so after that i did try the get the vector2 position data from touchscreen drag script, and aply to magic circle so that when drag is happen, magic circle move with it, in the base is the same thing with teleportation code above, that is ;
-----> i did try get the vector data from touchscreen drag event. <-----
like this:
func _process(delta):
print(target_drag_pos.current_touch)
if skill_pressed == true:
if target_drag_pos.current_touch:
target.global_transform.origin.x = target_drag_pos.current_touch.x
target.global_transform.origin.y = 1
target.global_transform.origin.z = target_drag_pos.current_touch.y
its summon it, but same thing happen again, vectors do not mach eachother.
this is dragevent code:
extends Node2D
var touch_position = Vector2()
var current_touch = Vector2()
func _ready():
set_as_toplevel(true)
func _input(event):
if event is InputEventScreenTouch and event.is_pressed():
touch_position = event.get_position()
if event is InputEventScreenDrag:
current_touch = event.get_position()
output:
https://streamable.com/mu1edt
i dont understand where and what i did was wrong?
can some one pls help me ?