Messenger like basketball game

Hello everyone,

I’m currently working on a basketball game in the messenger app where the player can shoot the ball by dragging it (or swiping up). I’m using physics engine 2, and I’m having trouble with the shooting mechanism. Specifically, I’m trying to identify the distance between the first touch and the touch release to determine the shooting angle and power.

I have a few questions regarding this. Firstly, why is there an identifier in the touch release event? I only want to detect when the touch has ended, so I’m not sure why I need to specify an identifier.

Secondly, I was wondering if anyone has any suggestions on how to implement the shooting mechanism in a better way. I’m open to any ideas that can help me create a smooth and engaging shooting experience for my players.

Thank you in advance for your help!

hmm. what about a mechanism such as in angry birds? that might be a little easier. it really just depends on whether the game is slow paced as in angry birds or is it fast paced like a real basketball game. if fast paced you actually could do an angry birds style shooting by changing the time scale of the scene. let me know if this works, or if you are looking for something else

in response to the first question, i have no idea. could be because you can have multiple touches, but really it should just pick the one that you are talking about in the event.

I can’t make it looks like angry bird game because the rings are like this, the player can shoot anywhere in the ring with correct color or answer. can anyone help me how do I make it shoot?

anyone? Apologies for spamming.

Well, I can’t help with the game. But if you’re looking for the first touch identifier on mobile (or at least Android) it’s 1. On pc with mouse and touchscreen it’s 2 for some reason. Personally, I think it reserves 1 for the mouse in that case, even if it’s not in use. I think I’ve read the first touch identifier should be 0 but I can’t get that to work, so I think it means in the array that is keeping track of touches the first touch is stored at index 0.

But I’m just wondering couldn’t you aim with a cursor event?