Blender game: How can I make a ball roll while moving?
Torque causes rotational motion; therefore, applying torque will make the ball roll. This can be done with logic bricks or with python.

For both ways start out on the ball's physics, set Physics Type to Ridge Body and adjust the radius to the the size of the ball.


Logic bricks

Then on the ball add a Motion actuator. On the motion actuator, uncheck use local torque (the L on the right) and set the torque on one of the axes.



Connect keyboard sensors to the motion actuators with corresponding torque for the axis.  



Python

Using python, create a text block and add this script.

from bge import logic, events

cont = logic.getCurrentController()
keyboard = logic.keyboard.events

x, y = 0, 0

if keyboard[events.UPARROWKEY]: x += 1
if keyboard[events.DOWNARROWKEY]: x -= 1
if keyboard[events.LEFTARROWKEY]: y += 1
if keyboard[events.RIGHTARROWKEY]: y -= 1

cont.owner.applyTorque((x, y, 0))


Then connect an Always sensor to a Python controller and activate TRUE level triggering.


Result
The logic bricks or script will roll the ball. *This is a monkey shaped ball.*