+1 vote
func _process(delta):
  if dragging:
    var size = player.allCards.size()
    if CONFIG.turnToPlay.pName == "Me" and size == 7:
        if get_global_mouse_position().y > 232 and get_global_mouse_position().y < 307:
            position = get_global_mouse_position()
            rotation_degrees = 0
            notCardTake = true
            if position.y > 290:
                notCardTake = false
                emit_signal("taked_a_card", self)
        if get_global_mouse_position().y > 410:
            on_set_pickable(player, self)
            position.x = get_global_mouse_position().x
    if CONFIG.turnToPlay.pName == "Me" and size == 8:
        if get_global_mouse_position().y > 445:
            var diffY = abs(get_global_mouse_position().y - y)
            var diffX = abs(get_global_mouse_position().x - x)
            on_set_pickable(player, self)
            if diffX > diffY:
                position.x = get_global_mouse_position().x
            if diffY > diffX:
                position.y = get_global_mouse_position().y
                if get_global_mouse_position().y < 452:
                    player.call_deferred("throw_a_card", self)
    if CONFIG.turnToPlay.pName != "Me" and size == 7:
        if get_global_mouse_position().y > 410:
            on_set_pickable(player, self)
            position.x = get_global_mouse_position().x

func _input_event(viewport, event, shape_idx):
   if event is InputEventScreenTouch:
    if event.pressed:
        dragging = true
        x = event.position.x
        y = event.position.y
        initPosition = position
        initAngle = rotation_degrees
        notCardTake = false
        if player:
            self.set_z_index(25+player.allCards.size())
        print("Touch")
        self.get_tree().set_input_as_handled()
    else:
        dragging = false
        if notCardTake:
            position = initPosition
            rotation_degrees = initAngle
        do_arrange()
        print("Released")
        self.get_tree().set_input_as_handled()
in Engine by (21 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.