Hello guys, I’ve been mulling away trying to find a solution to my problem.
I have a hero character that uses a touch on the hero object and a drag to use transition to in order to move to where the touch was released.
I have now introduced enemies into my game and I would like to add the ability for my hero to attack.
The goal is to touch my hero and drag the touch over an enemy and upon release my hero will transition to the enemy and start an auto attack. If touch is released on an area not occupied by an enemy I want the hero to just transition to the position as it does now.
I have been reading through the forums and have not really found an answer as to how to accomplish this so far.
Reading through the API I think it might be useful to use content bounds and track the enemies x & y min & max.
The only problem is that idk how to really track when touch is released within the bounds. Is it just as simple as having an if “released” and event.x > xMin etc… Then transition to enemy.x?
I’d appreciate any help