Post by Deleted on Jul 6, 2016 20:02:37 GMT -6
This is a SmallBASIC conversion by MGA/B+
Added instructions as comments.
I think is pretty cool. Kudos to MGA/B+
J
Added instructions as comments.
I think is pretty cool. Kudos to MGA/B+
'
' Paint Balls - SmallBASIC 2015-05-28 MGA/B+
'
WINDOWOPEN ( 0, "Paintballs", 0, 0, 800, 700, 0 )
CANVASOPEN ( 0, 800, 700, 0, 0, 800, 700, 0 )
' Select a colour:
' r = red y = yellow
' b = blue v = violet
' g = green w = white
' o = orange c = cyan
'
' Left Mouse Button = "draw"
' a = many various colours
' f = many of selected colour
'
' Delete = Clear screen
'
' Esc = Quit
'
xmax = 800
ymax = 700
randomize(timer())
sub ball(x,y,clr$)
for r = 32 to 0 step -1
if clr$ = "r" then
setColor(rgb(255-6*r,0,0))
circlefill(x,y,r)
end if
if clr$ = "b" then
setColor(rgb(0,0,255-6*r))
circlefill(x,y,r)
end if
if clr$ = "g" then
setColor(rgb(0,220-6*r,0))
circlefill(x,y,r)
end if
if clr$ = "y" then
setColor(rgb(256-4*r-1,256-4*r,0))
circlefill(x,y,r)
end if
if clr$ = "v" then
setColor(rgb(256-7*r,0,256-7*r))
circlefill(x,y,r)
end if
if clr$ = "w" then
setColor(rgb(255-4*r-1,255-4*r-1,255-4*r-1))
circlefill(x,y,r)
end if
if clr$ = "c" then
setColor(rgb(0,196-3*r-1,196-3*r-1))
circlefill(x,y,r)
end if
if clr$ = "o" then
setColor(rgb(255-3*r-1,180-4*r-1,0))
circlefill(x,y,r)
end if
next
end sub
sub autofill()
for i=1 to 100
x=int(rand(xmax))
y=int(rand(ymax))
c=int(rand(9))
cs$=mid("rgbyovkcw",c,1)
ball(x,y,cs$)
next
end sub
sub fill(cs$)
for i=1 to 100
x=int(rand(xmax))
y=int(rand(ymax))
ball(x,y,cs$)
next
end sub
clr$ = "r"
mousex = 0
mousey = 0
mb1 = 0
mb2 = 0
mb3 = 0
ClearCanvas()
while key(k_escape) = 0
getMouse(mousex,mousey,mb1,mb2,mb3)
if key(k_b) then
clr$ = "b"
end if
if key(k_r) then
clr$ = "r"
end if
if key(k_g) then
clr$ = "g"
end if
if key(k_y) then
clr$ = "y"
end if
if key(k_v) then
clr$ = "v"
end if
if key(k_w) then
clr$ = "w"
end if
if key(k_c) then
clr$ = "c"
end if
if key(k_o) then
clr$ = "o"
end if
if key(k_a) then
autofill()
end if
if key(k_f) then
fill(clr$)
end if
if key(k_delete) then
ClearCanvas()
end if
if mb1 = 1 then
x = mousex
y = mousey
ball(x,y,clr$)
end if
Update()
wend
WINDOWCLOSE(0)
J