small update, now when you've worked out what type of color bar pattern you want it can now be secleted with bartype, plus also added segment type lines to the bars.
Rem Project: Dark Basic Pro Project
Rem Created: Wednesday, May 26, 2010
Rem ***** Main Source File *****
Rem ***** Main Source File *****
sync on
sync rate 60
backdrop on
autocam off
position camera 0,2,-5
set image colorkey 0,0,0
set text size 42
rem make object and flatten and fix rotations
make object sphere 1,3,40,40
scale object 1,100,0,100
rotate object 1,-180,30,0
fix object pivot 1
rem some globals and stuff
global bx,by,height,sh,power,revs,brake
rem bitmap screen size
bx=600
by=500
height=50 :rem bar height
rem make area to make image and send to texture
create bitmap 1,bx,by
make camera 1
set camera to image 1,1,bx,by,2
rem make delay timer
t=timer()
delay=1000
rem makes object clear
set object transparency 1,2
do
rem random position for bars not needed when you got really values
if timer()>t+delay
sh=by
power=rnd(270)
revs=rnd(270)
brake=rnd(270)
t=timer()
endif
rem make the iamge and texture object
getimage()
rem just to rotate object
xrotate object 1,wrapvalue(object angle x(1)-.1)
sync
loop
end
function getimage()
set current bitmap -1
cls 0
rem showspeed() format
rem text to use at begining of bar
rem length of bar to show based on power value
rem height of bar - based on text height
rem start position on the x direction
rem sart postion on the y direction
rem four colors used
rem bartype pattern required
rem segtype pattern required
showspeed(" Power",power,height,0,sh-height*2,rgb(0,155,0),rgb(0,64,0),rgb(0,155,0),rgb(0,64,0),3,1)
showspeed(" Revs",revs,height,0,sh-(height*3),rgb(155,155,0),rgb(155,64,0),rgb(155,155,0),rgb(155,64,0),2,2)
showspeed("Brakes",brake,height,0,sh-(height*4),rgb(155,0,155),rgb(155,0,64),rgb(155,0,155),rgb(155,0,64),1,3)
set current bitmap 0
texture object 1,1
endfunction
rem make bars and adds text and colors
function showspeed(text$,x,y,posx,posy,color1,color2,color3,color4,bartype,segtype)
tw = text width(text$)
text 0,posy,text$
if bartype=1
box posx+tw,posy,(posx*2)+x+tw,posy+y-1,color1,color2,color3,color4
endif
if bartype=2
box posx+tw,posy,(posx*2)+x+tw,posy+(y/2),color1,color2,color3,color4
box posx+tw,posy+(y/2),(posx*2)+x+tw,posy+y-1,color2,color1,color4,color3
endif
if bartype=3
box posx+tw,posy,(posx*2)+x+tw,posy+(y/2),color1,color2,color3,0
box posx+tw,posy+(y/2),(posx*2)+x+tw,posy+y-1,0,color1,color4,color3
endif
for ls=5 to x step 6
if segtype=1
box posx+tw+ls,posy,posx+tw+ls+1,posy+y,rgb(0,0,0),rgb(0,0,0),rgb(0,0,0),rgb(0,0,0)
endif
if segtype=2
box posx+tw+ls,posy,posx+tw+ls+1,posy+y,rgb(0,0,0),color2,rgb(0,0,0),rgb(0,0,0)
endif
if segtype=3
box posx+tw+ls,posy,posx+tw+ls+1,posy+y,color2,rgb(0,0,0),rgb(0,0,0),rgb(0,0,0)
endif
next ls
endfunction
Dark Physics makes any hot drink go cold.