here is my question
I want to make a ball move anywhere on the map but I can only make it move forward can anyone write a step back,left and right so that i can make it move everywhere here is the code:
Your code is too static. Using this code, if you used variable 'a' as a determining factor of where the ball is at some point in time, this would be extremely inefficient.
You need to assign a multidimensional array with each axis of movement in space. Have one for X (horizontal) y (verticle), you don't need depth for non 3D project, I'm assuming. This will allow for up down left and right movement.
char ballCourt ;
Then just use for loops to assign the correct character to ballCourt (looks like your using 'O') for where the position of the ball is suppose to be, and blank spaces or a symbol (it looks like your using I) to represent each unit of space for the field of play or "ballCourt"
I suggest you read up on array's. They are a powerful type of variable that allows you to store an almost endless amount of values, separated by creating an inner element for each one, in which all can be accessed by a unique index number or name