# GUI device for throwing a ball

The hero has a ball, which shall be thrown with accuracy in a court on iPhone/iPad. The player is seen from above, in a 2D view. In game play, the player reach is between 1/15 and 1/6 of the height of the iPhone screen. The player will run, and try to outmaneuver his opponent, and then throw the ball at a specific location, which is guarded by the opponent (which is also shown on the screen). The player is controlled by a joystick, and that works ok, but how shall I control the stick?

Maybe someone can propose a third control method?

I've tried the following two approaches:

Joystick:

• Hero has a reach of 1 meter, and this reach is marked with a semi-opaque circle around the player.
• The ball can be moved by a joystick. When the joystick is moved south, the ball is moved south within the reach circle. There is a direct coupling with the joystick and the position of the ball. I.e. when the joystick is moved max south, the ball is max south within the player reach.
• At each touch update the speed is calculated, and the Box2d ball position and ball speed are updated. NB, the ball will never be moved outside the reach as long as the player push the joystick.
• The ball is thrown by swiping the joystick to make the ball move, and then releasing the joystick. At release, the ball will get a smoothed speed of the joystick.

Joystick Problem:

• The throwing accuracy gets bad, because the joystick can not be that big, and a small movement results in quite a large movement of the ball.
• If the user does not release before the end of the joystick maximum end point, the ball will stop, and when the user releases the joystick the speed of the ball will be zero. Bad...

• A force is applied to the ball by a sweep on a touchpad.
• The ball is released when the sweep is ended, or when the ball is moved outside the player reach.
• As there is no one to one mapping between the swipe and the ball position, the precision can be improved. A large swipe can result in a small ball movement.

• A touchpad is less intuitive. Users do not seem to know what to do with the touch pad. Some tap the touchpad, and then the ball just falls to the ground.
• As there is no one-to-one mapping, the ball can be moved outside the reach, and then it will just fall to the ground. It's a bit hard to control the ball, especially if the player also moves.
• We don't have enough information, here. If the game was just about, say, shooting freethrows, with the camera positioned at side-court, or positioned over the player's shoulder, the answer would be very different than if you were making a 2D fast-paced action-platformer like the old (NES) Ninja Gaiden games, except that the hero has a dodge-ball instead of a sword, and you need to control the angle and power of each throw in real time, while also dodging attacks and jumping from platform to platform (which needs a two-stick controller or keyboard+mouse). What is the expectation of the player? Nov 28, 2012 at 18:19
• I've updated the description. Will have a look at the games you mention! Thanks! Nov 28, 2012 at 20:05
• Based on your updates, I'd consider the following: 1) use a tap, and have the tactic to be to throw the ball to the location of the tap, using the movement of the character and the placement of the tap (the trajectory of the ball) to try to deke the defender 2) use a joystick for movement and use a swipe (/"fling") to throw, which will make accuracy much harder, but will also offer speed as well as vector, based on the swipe. If you go that route, though, you need to: a) provide instruction -- it's not intuitive, b) be forgiving in aim/defense, and allow for people to cancel out of a throw. Nov 28, 2012 at 21:25
• Ah, didn't think of 1. Maybe the way to go! A pity you didn't answer by a real answer so I could increase your reputation. Why don't you create one? ;) Nov 28, 2012 at 22:49