It depends on what your trying to do.
It looks like you want some graphic on the screen for telling you players speed.
I agree that using a sprite would be more efficient, but I don't see why
box 10,10,speed,40,red,red,red,red wouldn't work.
The error might just be the placement of the box command.
Did you put it inside your main loop?
If you didn't then it will not show up.
Did you make red = rgb(255,0,0)?
If not then your box might just be invisible.
It turns out that you can make cool transparent effects if you mix black with other colors.
I didn't even know that, I just figured that out.
Just so you know, you can select from about 16777216 different colors by clicking on the right mouse button, and then clicking on Insert RGB Colour.
Anyways, this is what I came up with.
Reset: `The reset point for reseting
Rem sets up a fullscreen display with a resolution of 640 by 480
set display mode 640,480,32 `I don't know why, but I believe this resets everything, if you were wondering why the cube does not have to be deleted.
set window layout 0,0,0
maximize window
sync on : sync rate 60 `Set the sync frames per second to 60
red = rgb(255,0,0) `Puts a color value of red into the variable red
black = 0 `color number 0
color backdrop RGB(64,0,64) `creates a dark purple background color
Rem make 3D stuff
make object cube 1,1
speed = 0 `the speed variable
Rem The main loop
do
inc speed,1 `increase the speed
if speed > 620 then speed = 620 `Puts a maximum speed so that it does not go off the screen
Rem rotate 3D stuff, based on the speed of speed
turn object right 1,speed/100.0
Rem Draws the box things with a cool transparency
box 10,10,speed+10,25,red,black,red,black
box 10,25,speed+10,40,black,red,black,red
Rem Resets the program if the user presses a key on the keyboard
if inkey$() <> "" `if the user presses a key
while inkey$() <> "" : endwhile `waits for the user to let go of the key
goto Reset `goes back to the start of the program
endif
rem display text
center text 320,240,"Press a key to reset"
center text 320,252,"Press the Esc key to exit"
sync `update the screen
loop `end of the main loop
end `end of the program
If you are going to use sprites instead, you will need to scale, and position the sprite based on the variable speed, it will be much more difficult. And making a transparency effect will also be more difficult. Using a sprite will run much faster, but since it doesn't look like you need 100 boxes, I don't think that using boxes will slow things down very much.
Also if you don't want a gradient or transparency effect on your box.
Then you can use the ink command instead for selecting a color for your box. I'm not sure, but I think that it might run faster too.
And using a plain would not have to be repositioned more then a sprite would. Just on the x axis, however you would need to use
disable object zdepth, and use
lock object on in order for it to be fixed to the screen, and not be effected by the 3D environment. And since it is a 3D object, it would be much more difficult to get the object to be the right size and position on the screen.
You could also do it by repositioning it and rotating it to follow the camera, but you would still have to diable the objects z depth, or the plain will be effected by the 3D environment.
Hope that helps.
And if you think that I over complicated it, because I did, here is a simplified version of the program.
sync on : sync rate 60 `Set the sync frames per second to 60
ink rgb(255,0,0),0 `Makes everything 2D Red
Rem make 3D stuff
make object cube 1,1
Rem The main loop
do
inc speed,1 `increase the speed
if speed > 620 then speed = 620 `Puts a maximum speed so that it does not go off the screen
Rem rotate 3D stuff, based on the speed of speed
turn object right 1,speed/100.0
Rem Draws the box
box 10,10,speed+10,40
rem display text
center text 320,240,"Press the Esc key to exit"
sync `update the screen
loop `end of the main loop
I like games, and stuff.