Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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...

Touch pad

  • 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.

Touch Pad Problem

  • 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.
share|improve this question
    
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? –  Norguard Nov 28 '12 at 18:19
    
I've updated the description. Will have a look at the games you mention! Thanks! –  Fredrik Johansson Nov 28 '12 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. –  Norguard Nov 28 '12 at 21:25
1  
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? ;) –  Fredrik Johansson Nov 28 '12 at 22:49

1 Answer 1

up vote 0 down vote accepted

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 to an end-user at all, so you need to provide visual queues/tutorials to get the player started (an important and often-overlooked part of modern game design)

b) be forgiving in aim/defense, and allow for people to cancel out of a throw.

share|improve this answer
    
Short feedback: I used 1, with a small modification. I did not want to use an on screen tap for two reasons: a) taps/sweeps are used for pan & zoom b) I want to keep the fingers from the gameplay. My solution was to control a crosshair by a joystick, and then let the hero throw the ball towards the crosshair when that joystick is released. Maybe need to find out a way to cancel a throw, but overall I'm very satisfied with that solution. Thanks @Norguard! –  Fredrik Johansson Nov 29 '12 at 22:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.