Have a read though this code. It should give you the basic ideas
sync on
sync rate 30
autocam off
REM Make and position the ball
make object sphere 1, 1.0
position object 1, 0.0, 0.0, 0.0
REM Make and position the left wall
make object box 2, 0.1, 1.0, 10.0
position object 2, -3.0, 0.0, 0.0
REM Make and position the right wall
make object box 3, 0.1, 1.0, 10.0
position object 3, 3.0, 0.0, 0.0
REM Set the camera to look down from above
position camera 0.0, 5.0, 0.0
point camera 0.0, 0.0, 0.0
REM This value shows the direction the ball is heading.
REM Use 1 to move right, or -1 to move left
Direction=1
while scancode() = 0
REM Reposition the object depending on the value of the Direction variable
if Direction = 1
REM Add 0.1 to the x position to move right
position object 1, object position x(1)+0.1, object position y(1), object position z(1)
else
REM Subtract 0.1 from the x position to move left
position object 1, object position x(1)-0.1, object position y(1), object position z(1)
endif
REM If the ball is touching the left wall, then set the direction to move right
if object collision(1, 2) = 1 then Direction = 1
REM If the ball is touching the right wall then set the direction to move left
if object collision(1, 3) = 1 then Direction = -1
sync
endwhile
*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++
http://www.matrix1.demon.co.uk