What your code does at the moment is not loop at all. You load up all the media, and then as soon as you've done that you check to see if either of the arrow keys you want are pressed. If they are, it moves the object. Then the command 'suspend for key' is used, which stops the program running until a key is pressed. After that, the program just ends, the screen doesn't update or anything.
You need a main loop, otherwise it won't work. A main loop is a do...loop command, with all the code to make the game work inside. It runs repeatedly throughout the game, so you can move your objects and run various other pieces of code repeatedly.
First you load up all the media, like you have done so.
Then you start the main loop
do
Inside the loop, you code what is going to happen each frame. You're trying to get the object to move left and right when you press the arrow keys, so you put that code inside the loop.
if leftkey()=1 then move object left 1,50
if rightkey()=1 then move object right 1,50
Then, when you've done everything you want to do that frame, use sync to draw it to the screen and loop around again. Your code should look like this:
Rem Project: first game
Rem Created: 2003-02-04 12:12:29
Rem ***** huvud fil *****
sync on
sync rate 30
hide mouse
rem load pic-files
rem placing the camera
make camera 1
position camera 1,0,0,0
color backdrop 1,RGB(0,0,0)
rem make the player
make object box 1,10,2,2
color object 1,RGB(255,255,0)
position object 1,0,-25,50
rem make ball
make object sphere 2,2
color object 2,RGB(0,255,0)
position object 2,0,-23,50
rem build the level
make object cube 3, 50
color object 3,RGB(255,0,0)
position object 3,0,0,0
rem lights
make light 1
make light 2
make light 3
color light 1,RGB(0,255,64)
color light 2,RGB(255,0,128)
color light 3,RGB(0,255,255)
position light 1,0,50,0
position light 2,0,100,0
position light 3,0,70,50
do
if leftkey()=1 then move object left 1,50
if rightkey()=1 then move object right 1,50
sync
loop
Now the program will exit if you press the escape key by default, but otherwise will keep running, checking for keypresses and updating the objects every frame.
Once I was but the learner,
now, I am the Master.