`chracter challenge
`by tone3e
gosub setup
`main loop
do
   cls
   gosub set_bars
   `setting up bars
      gosub speed
      gosub strenght
      gosub stamina
      gosub intelligence
      `choosing bar
      if downkey()=1 and tag=0
         place=place+1
         tag=1
      endif
      if upkey()=1 and tag=0
         place=place-1
         tag=1
      endif
      if upkey()=0 and downkey()=0 then tag=0
      if place=<1 then place=1
      if place>4 then place=4
      set text size 10
      text 200,180,"<<<[Press SpaceKey To Finalize Character]>>>"
      if spacekey()=1
         cls
         Print "IFORMATION"
         Print "Character Name: ";Name$
         Print "Character Sex: ";Sex$
         Print "Character Guild: ";Guild$
         Print "Character Body Type:";Body$
         pRINT "ATTRIBUTES"
         pRINT "Speed: ";z;"%"
         Print "Strenght: ";z2;"%"
         Print "Stamina: ";z3;"%"
         Print "Intelligence: ";z4;"%"
         end
      endif
   sync
loop
end
 
setup:
set display mode 640,480,32
sync on: sYNC rATE 0
hide mouse
`set variables
total_points=0:place=0
tag=0:tag2=0
z=0:z2=0:z3=0:z4=0
`collect information
input "Character Name?> ";Name$
Input "Character Guild?> ";Guild$
Input "Character Sex?> ";Sex$
Input "Character Body Type?> ";Body$
return
 
set_bars:
    total_points=200-(z+z2+z3+z4)
    if total_points<0 then total_points=0
    PRINT "Total Points: ";total_points
    `draw bars
    `speed
    draw_bar(100,60,100,7884864,z,12582912)
    draw_bar(100,90,100,7884864,z2,12582912)
    draw_bar(100,120,100,7884864,z3,12582912)
    draw_bar(100,150,100,7884864,z4,12582912)
return
 
speed:
   `speed
   if place=1
      draw_bar(100,60,100,884864,z,12582912)
      SET CURSOR 0,55
      PRINT "Speed: ";Z
      if rightkey()=1 AND Z<100 and total_points>0 then z=z+1
      if leftkey()=1 AND Z>0 then z=z-1
   endif
return
 
strenght:
   `strenght
   if place=2
      draw_bar(100,90,100,884864,z2,12582912)
      SET CURSOR 0,85
      PRINT "Strenght: ";Z2
      if rightkey()=1 AND Z2<100 and total_points>0 then z2=z2+1
      if leftkey()=1 AND Z2>0 then z2=z2-1
    endif
return
 
 
stamina:
`stamina
   if place=3
      draw_bar(100,120,100,884864,z3,12582912)
      SET CURSOR 0,115
      PRINT "Stamina: ";Z3
      if rightkey()=1 AND Z3<100 and total_points>0 then z3=z3+1
      if leftkey()=1 AND Z3>0 then z3=z3-1
    endif
return
return
 
intelligence:
`intelligence
   if place=4
      draw_bar(100,150,100,884864,z4,12582912)
      SET CURSOR 0,145
      PRINT "Intelligence: ";Z4
      if rightkey()=1 AND Z4<100 and total_points>0 then z4=z4+1
      if leftkey()=1 AND Z4>0 then z4=z4-1
    endif
return
return
`functions
function draw_bar(x,y,width,color,fill,fillcolor)
   ink color,0
   line x+1,y,x+width-1,y
   box x,y+1,x+1,y+2
   box x+width-1,y+1,x+width,y+2
   line x+1,y+3,x+width-1,y+3
   ink 0,0
   box x+2,y+1,x+width-2,y+2
   draw_status(x,y,fill,fillcolor)
endfunction
 
function draw_status(x,y,width,color)
   ink color,0
   box x+2,y+1,x+width-2,y+2
endfunction