Reigns Clone in godot

Hello!

I’ve got some problem with trying to make Reigns clone in godot.

func _input(event): # если мы касаемся экрана или тянем карту и пока палец нажат, работает поворот и анимация влево-вправо
	if event is InputEventScreenDrag or (event is InputEventScreenTouch and event.is_pressed()):
		IsInTouch = true
		print (IsInTouch)
		set_global_position(event.position)
		rotationos()
		leftrightanimation()
		
		if get_button_pos().length() > boundary:
			IsInTouch = false
			set_position(get_button_pos().normalized() * boundary)
			rotationos()
			
		elif get_button_pos().length() > 4 and not (event is InputEventScreenTouch and event.is_pressed()):
			$AnimationPlayer.play("LeftChoose")

I want to do that after the player pulls the card to the left and releases it, the animation of its movement to the left as it was in the original. But instead, something inexplicable happens, which we can see in this video. Video

Can you tell us how to make the event trigger under two conditions? We move the card to the left and let your finger off the screen. I wrote it in code but it doesn’t work correctly. What did I do wrong?

im guessing what you want is to drag the card, and once outwith the boundary its animation plays and goes off screen?

not tried amy touchscreen events yet.
but, if its a one shot deal.

possibly, while its being dragged, if the drag goes outwith the boundary, i would make the card ‘un-touchable’ or not clickable so that the object would go off on its discard animation and wouldnt be troubled with any touch events.

just thinking out loud.

I managed to solve the problem. It turns out that there are two methods that can’t be called in the main scene at the same time.

The “_input(event)” method blocked the “_unhandled_input(event)” method.

The problem was solved by moving all events to one “_input(event)” method.

Thanks for updating Alexey,
just in case others get a similar issue on their journey.

and keep us all posted how your getting on since the project looks nice and interesting and looking sweet
:wink:

Thank you. I will xD

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.