Code: Select all
'------------------------------
' SPRITE CREATOR
'------------------------------
'graphic commands save extension = *.spr
template$ = "*.spr"
'bitmap extension = *.bmp
bmpTemplate$ = "*.bmp"
[main]
'dont open a mainwindow
nomainwin
WindowWidth = 900
WindowHeight = 750
UpperLeftX = (DisplayWidth - WindowWidth)/2
UpperLeftY = (DisplayHeight - WindowHeight)/2
graphicbox #main.graph, 10, 10, 600, 500
button #main.button1, "Next >>", [next], UL, 540, 630, 100, 30
open "Sprite Creator Step 1 of 3" for graphics_nf_nsb as #main
'check for the user input
print #main.graph, "when leftButtonDown [drawBoxStart]"
print #main.graph, "when leftButtonMove [drawBox]"
print #main.graph, "when leftButtonUp [endBox]"
print #main, "fill Buttonface ; flush"
print #main, "down ; place 100 640 ; font helvetica 12 bold ; color black ; backcolor Buttonface ;\Step 1 : First draw the box within which you want"
print #main, "\to draw your sprite within the white area."
print #main.button1, "!disable"
print #main, "trapclose [quit]"
wait
[drawBoxStart]
startX = MouseX
startY = MouseY
print #main.graph, "size 0.5 ; down ; color black ; place ";startX;" ";startY;""
wait
[drawBox]
count = count + 1
print #main.graph, "discard ; redraw ; color black ; place ";startX;" ";startY;" ; box ";MouseX;" ";MouseY;""
oldX = MouseX
oldY = MouseY
width = MouseX - startX
height = MouseY - startY
if left$(str$(width), 1) = "-" then width = width * -1
if left$(str$(height), 1) = "-" then height = height * -1
print #main, "place 100 700 ; font helvetica 12 bold ; color black ; backcolor Buttonface ;\Width = ";width;" Height = ";height;" "
wait
[endBox]
endX = MouseX
endY = MouseY
print #main.graph, "discard ; redraw"
print #main.graph, "down ; place ";startX;" ";startY;" ; box ";endX;" ";endY;""
print #main.button1, "!enable"
print #main, "place 100 640 ;\Now click next to proceed. "
print #main, "\ "
wait
[quit]
timer 0
print #main.graph, "cls"
print #main, "cls"
close #main
count = 0
startX = 0
startY = 0
endX = 0
endY = 0
end
[next]
boxWidth = width
print #main.graph, "cls"
print #main, "cls"
count = 0
close #main
boxWidth = endX - startX
boxHeight = endY - startY
if left$(str$(boxWidth), 1) = "-" then boxWidth = boxWidth * -1
if left$(str$(boxHeight), 1) = "-" then boxHeight = boxHeight * -1
menu #main, "Tools", "Default Brush", [default], "Eraser", [eraser], |, "Draw Line", [drawLineSet], "Draw Box", [drawBoxSet], "Draw Circle", [drawCircleSet], |, "Air Brush", [airBrush]
graphicbox #main.graph, 10, 10, boxWidth, boxHeight * 2
graphicbox #main.graphRed, 600, 100, 256, 25
graphicbox #main.graphGreen, 600, 150, 256, 25
graphicbox #main.graphBlue, 600, 200, 256, 25
graphicbox #main.fore, 700, 300, 50, 50
graphicbox #main.back, 700, 400, 50, 50
button #main.button1, "Save As Bitmap", [save], UL, 600, 700, 200, 30
button #main.button2, "Clear", [clear], UL, 600, 750, 200, 30
button #main.button4, "Save As Graphic Commands", [saveGraph], UL, 600, 800, 200, 30
textbox #main.size, 100, (boxHeight * 2) + 250, 100, 30
button #main.increase, "/\", [sizeIncrease], UL, 220, (boxHeight * 2) + 250, 20, 20
button #main.decrease, "\/", [sizeDecrease], UL, 220, (boxHeight * 2) + 280, 20, 20
open "Sprite Creator Step 2 of 3" for graphics_nsb_fs as #main
open "";DefaultDir$;"\sprite.spr" for append as #spr
print #main.graph, "place 0 ";boxHeight;" ; down ; color black ; backcolor black ; boxfilled ";boxWidth;" ";boxHeight * 2;""
print #main, "place 50 ";(boxHeight * 2) + 265;" ; font helvetica 12 bold ; color black ;\Size : "
print #main.size, "3"
'filling the three color bars to allow the user to mix the three basic colors red, green and blue
color = -1
place = -1
for X = 1 to 256
color = color + 1
place = place + 1
print #main.graphRed, "down ; size 1 ; north ; place ";place;" 25 ; color ";color;" 0 0 ; go 30"
next X
print #main.graphRed, "flush"
color = -1
place = -1
for X = 1 to 256
color = color + 1
place = place + 1
print #main.graphGreen, "down ; size 1 ; north ; place ";place;" 25 ; color 0 ";color;" 0 ; go 30"
next X
print #main.graphGreen, "flush"
color = -1
place = -1
for X = 1 to 256
color = color + 1
place = place + 1
print #main.graphBlue, "down ; size 1 ; north ; place ";place;" 25 ; color 0 0 ";color;" ; go 30"
next X
print #main.graphBlue, "flush"
print #main, "place 50 ";(boxHeight * 2) + 100;" ; font helvetica 12 bold ;\Step 2 : Draw your sprite in its original colors"
print #main, "\within the black area. You will not be able to use black."
print #main, "\Don't let your picture go out of the black area or"
print #main, "\your sprite will not work properly."
print #main, "place 500 120 ; font helvetica 12 bold ; color red ;\Red :"
print #main, "place 500 170 ; font helvetica 12 bold ; color green ;\Green :"
print #main, "place 500 220 ; font helvetica 12 bold ; color blue ;\Blue :"
print #main, "color black ; place 650 280 ; font helvetica 12 bold ;\Foreground Color :"
print #main, "color black ; place 650 380 ; font helvetica 12 bold ;\Background Color : "
print #main.graph, "place 100 ";(boxHeight * 2) + 250;" font helvetica 12 bold ;\Ready! "
print #main.graphRed, "when leftButtonMove [redForeCheck]"
print #main.graphRed, "when rightButtonMove [redBackCheck]"
print #main.graphGreen, "when leftButtonMove [greenForeCheck]"
print #main.graphGreen, "when rightButtonMove [greenBackCheck]"
print #main.graphBlue, "when leftButtonMove [blueForeCheck]"
print #main.graphBlue, "when rightButtonMove [blueBackCheck]"
print #main, "trapclose [quita]"
color$ = "1 1 1"
backcolora$ = "255 255 255"
size = 3
print #main.graph, "flush"
[mainCheckLoop]
print #main.graph, "when leftButtonMove [draw]"
print #main.graph, "when leftButtonDown [draw]"
print #main.graph, "when leftButtonUp [flush]"
print #main.graph, "when rightButtonMove [drawB]"
print #main.graph, "when rightButtonDown [drawB]"
print #main.graph, "when rightButtonUp [flush]"
print #main, "when characterInput [keyCheck]"
print #main, "setfocus"
[timeIt]
timer 50, [updateDisplay]
wait
[draw]
if MouseY < (boxHeight + (size/2)) then MouseY = boxHeight + (size/2)
if MouseY > ((boxHeight * 2) - (size/2)) then MouseY = (boxHeight * 2) - (size/2)
x = MouseX
y = MouseY
print #main.graph, "place ";x;" ";y;" ; down ; color ";color$;" ; size ";size;" ; go 1"
print #main.graph, "place ";x;" ";y - boxHeight;" ; down ; color black ; size ";size;" ; go 1"
print #spr, "place ";x;" ";y;" ; down ; color ";color$;" ; size ";size;" ; go 1"
print #spr, "place ";x;" ";y - boxHeight;" ; down ; color black ; size ";size;" ; go 1"
print #main, "place 100 ";(boxHeight * 2) + 300;" ; font helvetica 12 bold ; color black ; backcolor white ;\X = ";MouseX;" Y = ";MouseY;" "
wait
[drawB]
if MouseY < (boxHeight + (size/2)) then MouseY = boxHeight + (size/2)
if MouseY > ((boxHeight * 2) - (size/2)) then MouseY = (boxHeight * 2) - (size/2)
x = MouseX
y = MouseY
print #main.graph, "place ";x;" ";y;" ; down ; color ";backcolora$;" ; size ";size;" ; go 1"
print #main.graph, "place ";x;" ";y - boxHeight;" ; down ; color black ; size ";size;" ; go 1"
print #spr, "place ";x;" ";y;" ; down ; color ";backcolora$;" ; size ";size;" ; go 1"
print #spr, "place ";x;" ";y - boxHeight;" ; down ; color black ; size ";size;" ; go 1"
print #main, "place 100 ";(boxHeight * 2) + 300;" ; font helvetica 12 bold ; color black ; backcolor white ;\X = ";MouseX;" Y = ";MouseY;" "
wait
[default]
print #main, "down ; place 850 580 ; color white ; backcolor white ; size 2 ; boxfilled 950 780"
size = 3
goto [mainCheckLoop]
wait
[flush]
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[redForeCheck]
redF = MouseX
if redF > 256 then redF = 256
if redF < 1 then redF = 1
wait
[greenForeCheck]
greenF = MouseX
if greenF > 256 then greenF = 256
if greenF < 1 then greenF = 1
wait
[blueForeCheck]
blueF = MouseX
if blueF > 256 then blueF = 256
if blueF < 1 then blueF = 1
wait
[redBackCheck]
redB = MouseX
if redB > 256 then redB = 256
if redB < 1 then redB = 1
wait
[greenBackCheck]
greenB = MouseX
if greenB > 256 then greenB = 256
if greenB < 1 then greenB = 1
wait
[blueBackCheck]
blueB = MouseX
if blueB > 256 then blueB = 256
if blueB < 1 then blueB = 1
wait
[updateDisplay]
color$ = str$(redF) + " " + str$(greenF) + " " + str$(blueF)
backcolora$ = str$(redB) + " " + str$(greenB) + " " + str$(blueB)
print #main.size, "";size;""
print #main.size, "!contents? size"
print #main.fore, "fill ";color$;""
print #main.back, "fill ";backcolora$;""
wait
[save]
char$ = ""
leng = 0
filedialog "Step 3 of 3 - Save your sprite", bmpTemplate$, bmp$
if bmp$ = "" then wait
print #main.graph, "getbmp save 0 0 ";boxWidth;" ";(boxHeight * 2);""
bmpsave "save", "";bmp$;".bmp"
'get the directory and make it the default
bmpTemplate$ = bmp$
leng = len(bmpTemplate$)
while char$ <> "\"
leng = leng - 1
bmpTemplate$ = left$(bmpTemplate$, len(bmpTemplate$) - 1)
char$ = mid$(bmpTemplate$, leng, 1)
wend
bmpTemplate$ = bmpTemplate$ + "\"
wait
[saveGraph]
char$ = ""
filedialog "Step 3 of 3 - Save your sprite in graphic commands", template$, spr$
if spr$ = "" then wait
close #spr
open "";DefaultDir$;"\sprite.spr" for input as #in
open "";spr$;".spr" for append as #out
'get the directory and make it the default
template$ = spr$
leng = len(template$)
while char$ <> "\"
leng = leng - 1
template$ = left$(template$, len(template$) - 1)
char$ = mid$(template$, leng, 1)
wend
template$ = template$ + "\"
[read]
line input #in, line$
print #out, line$
if eof(#in) = -1 then goto [readEnd] else goto [read]
[readEnd]
close #in
close #out
open "";DefaultDir$;"\sprite.spr" for append as #spr
notice "Save Complete!"
wait
[eraser]
print #main.graph, "when leftButtonMove [erase]"
print #main.graph, "when leftButtonDown [erase]"
print #main.graph, "when leftButtonUp [flush]"
wait
[erase]
print #main.graph, "down ; place ";MouseX;" ";MouseY;" ; color black ; size ";size + 20;" ; go 1"
print #main.graph, "down ; place ";MouseX;" ";MouseY - boxHeight;" ; color white ; size ";size + 20;" ; go 1"
print #spr, "down ; place ";MouseX;" ";MouseY;" ; color black ; size ";size + 20;" ; go 1"
print #spr, "down ; place ";MouseX;" ";MouseY - boxHeight;" ; color white ; size ";size + 20;" ; go 1"
wait
[clear]
print #main.graph, "cls"
print #main.graph, "place 0 ";boxHeight;" ; down ; color black ; backcolor black ; boxfilled ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "flush"
close #spr
kill "";DefaultDir$;"\sprite.spr"
open "";DefaultDir$;"\sprite.spr" for append as #spr
wait
[keyCheck]
key = asc(right$(Inkey$, 1))
if Inkey$ = "+" then goto [sizeIncrease]
if Inkey$ = "-" then goto [sizeDecrease]
if key = _VK_UP then goto [sizeIncrease]
if key = _VK_DOWN then goto [sizeDecrease]
if key = _VK_RETURN then goto [save]
if upper$(Inkey$) = "C" then goto [clear]
wait
[sizeIncrease]
size = size + 1
wait
[sizeDecrease]
size = size - 1
if size < 1 then size = 1
wait
[drawLineSet]
count = 0
print #main, "down ; place 850 580 ; color white ; backcolor white ; size 2 ; boxfilled 950 780"
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
print #main.graph, "when leftButtonMove [drawLine]"
print #main.graph, "when leftButtonDown [startLine]"
print #main.graph, "when leftButtonUp [finishLine]"
wait
[startLine]
startX = MouseX
startY = MouseY
startUY = MouseY - boxHeight
print #main.graph, "down ; place ";startX;" ";startY;""
wait
[drawLine]
count = count + 1
x = MouseX
y = MouseY
print #main.graph, "down ; size 0.5 ; color 220 220 220 ; line ";startX;" ";startY;" ";x;" ";y;""
print #main.graph, "down ; size 0.5 ; color 220 220 220 ; line ";startX;" ";startUY;" ";x;" ";y - boxHeight;""
if count mod 50 = 0 then print #main.graph, "discard ; redraw"
wait
[finishLine]
endX = MouseX
endY = MouseY
endUY = MouseY - boxHeight
count = 0
print #main.graph, "discard ; redraw"
print #main.graph, "size ";size;" ; color ";color$;" ; line ";startX;" ";startY;" ";endX;" ";endY;""
print #main.graph, "size ";size;" ; color black ; line ";startX;" ";startUY;" ";endX;" ";endUY;""
print #spr, "size ";size;" ; color ";color$;" ; line ";startX;" ";startY;" ";endX;" ";endY;""
print #spr, "size ";size;" ; color black ; line ";startX;" ";startUY;" ";endX;" ";endUY;""
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[drawBoxSet]
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 610 ; color darkblue ; box 930 650"
print #main, "flush"
print #main, "when leftButtonUp [boxCheck]"
goto [boxOnly]
[boxCheck]
if MouseX > 870 and MouseX < 950 and MouseY > 610 and MouseY < 650 then goto [boxOnly]
if MouseX > 870 and MouseX < 950 and MouseY > 660 and MouseY < 700 then goto [outlineAndFillBox]
if MouseX > 870 and MouseX < 950 and MouseY > 710 and MouseY < 750 then goto [fillBox]
wait
[boxOnly]
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 610 ; color darkblue ; box 930 650"
print #main, "flush"
print #main.graph, "when leftButtonDown [boxOnlyStart]"
print #main.graph, "when leftButtonMove [boxOnlyDraw]"
print #main.graph, "when leftButtonUp [boxOnlyFinish]"
wait
[boxOnlyStart]
startX = MouseX
startY = MouseY
startUY = MouseY - boxHeight
print #main.graph, "place ";startX;" ";startY;""
wait
[boxOnlyDraw]
count = count + 1
print #main.graph, "place ";startX;" ";startY;" ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY;""
print #main.graph, "place ";startX;" ";startUY;" ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY - boxHeight;""
print #main, "place 100 ";(boxHeight * 2) + 300;" ; font helvetica 12 bold ; color black ; backcolor white ;\X = ";MouseX;" Y = ";MouseY;" "
if count mod 50 = 0 then print #main.graph, "discard ; redraw"
wait
[boxOnlyFinish]
endX = MouseX
endY = MouseY
endUY = MouseY - boxHeight
print #main.graph, "discard ; redraw"
print #main.graph, "down ; color ";color$;" ; size ";size;" ; place ";startX;" ";startY;" ; box ";endX;" ";endY;""
print #main.graph, "down ; color black ; size ";size;" ; place ";startX;" ";startUY;" ; box ";endX;" ";endUY;""
print #spr, "down ; color ";color$;" ; size ";size;" ; place ";startX;" ";startY;" ; box ";endX;" ";endY;""
print #spr, "down ; color black ; size ";size;" ; place ";startX;" ";startUY;" ; box ";endX;" ";endUY;""
print #main.graph, "flush"
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[outlineAndFillBox]
count = 0
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 660 ; color darkblue ; box 930 700"
print #main, "flush"
print #main.graph, "when leftButtonDown [outlineAndFillBoxStart]"
print #main.graph, "when leftButtonMove [outlineAndFillBoxDraw]"
print #main.graph, "when leftButtonUp [outlineAndFillBoxFinish]"
wait
[outlineAndFillBoxStart]
startX = MouseX
startY = MouseY
startUY= MouseY - boxHeight
wait
[outlineAndFillBoxDraw]
count = count + 1
print #main.graph, "place ";startX;" ";startY;" ; down ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY;""
print #main.graph, "place ";startX;" ";startUY;" ; down ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY - boxHeight;""
if count mod 50 = 0 then print #main.graph, "discard ; redraw"
print #main, "place 100 ";(boxHeight * 2) + 300;" ; font helvetica 12 bold ; color black ; backcolor white ;\X = ";MouseX;" Y = ";MouseY;" "
wait
[outlineAndFillBoxFinish]
endX = MouseX
endY = MouseY
endUY = MouseY - boxHeight
count = 0
print #main.graph, "discard ; redraw"
print #main.graph, "place ";startX;" ";startY;" ; color ";color$;" ; size ";size;" ; down ; backcolor ";backcolora$;" ; boxfilled ";endX;" ";endY;""
print #main.graph, "place ";startX;" ";startUY;" ; color black ; backcolor black ; size ";size;" ; down ; boxfilled ";endX;" ";endUY;""
print #spr, "place ";startX;" ";startY;" ; color ";color$;" ; size ";size;" ; down ; backcolor ";backcolora$;" ; boxfilled ";endX;" ";endY;""
print #spr, "place ";startX;" ";startUY;" ; color black ; backcolor black ; size ";size;" ; down ; boxfilled ";endX;" ";endUY;""
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[fillBox]
count = 0
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 710 ; color darkblue ; box 930 750"
print #main, "flush"
print #main.graph, "when leftButtonDown [fillBoxStart]"
print #main.graph, "when leftButtonMove [fillBoxDraw]"
print #main.graph, "when leftButtonUp [fillBoxFinish]"
wait
[fillBoxStart]
startX = MouseX
startY = MouseY
startUY = MouseY - boxHeight
wait
[fillBoxDraw]
count = count + 1
print #main.graph, "place ";startX;" ";startY;" ; down ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY;""
print #main.graph, "place ";startX;" ";startUY;" ; down ; color 220 220 220 ; size ";0.5;" ; box ";MouseX;" ";MouseY - boxHeight;""
print #main, "place 100 ";(boxHeight * 2) + 300;" ; font helvetica 12 bold ; color black ; backcolor white ;\X = ";MouseX;" Y = ";MouseY;" "
if count mod 50 = 0 then print #main.graph, "discard ; redraw"
wait
[fillBoxFinish]
endX = MouseX
endY = MouseY
endUY = MouseY - boxHeight
print #main.graph, "discard ; redraw"
print #main.graph, "place ";startX;" ";startY;" ; color ";color$;" ; backcolor ";color$;" ; down ; boxfilled ";endX;" ";endY;""
print #main.graph, "place ";startX;" ";startUY;" ; color black ; backcolor black ; down ; boxfilled ";endX;" ";endUY;""
print #spr, "place ";startX;" ";startY;" ; color ";color$;" ; backcolor ";color$;" ; down ; boxfilled ";endX;" ";endY;""
print #spr, "place ";startX;" ";startUY;" ; color black ; backcolor black ; down ; boxfilled ";endX;" ";endUY;""
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[drawCircleSet]
count = 0
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 610 ; color darkblue ; box 930 650"
print #main, "flush"
print #main, "when leftButtonUp [circleCheck]"
goto [circleOnly]
[circleCheck]
if MouseX > 870 and MouseX < 930 and MouseY > 610 and MouseY < 650 then goto [circleOnly]
if MouseX > 870 and MouseX < 930 and MouseY > 660 and MouseY < 700 then goto [outlineAndFillCircle]
if MouseX > 870 and MouseX < 930 and MouseY > 710 and MouseY < 750 then goto [fillCircle]
wait
[circleOnly]
count = 0
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 610 ; color darkblue ; box 930 650"
print #main, "flush"
print #main.graph, "when leftButtonDown [circleOnlyStart]"
print #main.graph, "when leftButtonMove [circleOnlyDraw]"
print #main.graph, "when leftButtonUp [circleOnlyFinish]"
wait
[circleOnlyStart]
startX = MouseX
startY = MouseY
startUY = MouseY - boxHeight
wait
[circleOnlyDraw]
count = count + 1
print #main.graph, "place ";startX;" ";startY;" ; down ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY;""
print #main.graph, "place ";startX;" ";startUY;" ; down ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY - boxHeight;""
print #main, "place 100 ";(boxHeight * 2) + 300;" ; font helvetica 12 bold ; color black ; backcolor white ;\X = ";MouseX;" Y = ";MouseY;" "
if count mod 50 = 0 then print #main.graph, "discard ; redraw"
wait
[circleOnlyFinish]
endX = MouseX
endY = MouseY
endUY = MouseY - boxHeight
ellipseX = (endX - startX)/2
ellipseY = (endY - startY)/2
if ellipseX < 0 then ellipseX = ellipseX * -1
if ellipseY < 0 then ellipseY = ellipseY * -1
print #main.graph, "discard ; redraw"
print #main.graph, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2);" ; down ; color ";color$;" ; size ";size;" ; ellipse ";endX - startX;" ";endY - startY;""
print #main.graph, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2) - boxHeight;" ; down ; color black ; size ";size;" ; ellipse ";endX - startX;" ";(endUY - startUY);""
print #spr, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2);" ; down ; color ";color$;" ; size ";size;" ; ellipse ";endX - startX;" ";endY - startY;""
print #spr, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2) - boxHeight;" ; down ; color black ; size ";size;" ; ellipse ";endX - startX;" ";(endUY - startUY);""
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[outlineAndFillCircle]
count = 0
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 660 ; color darkblue ; box 930 700"
print #main, "flush"
print #main.graph, "when leftButtonDown [outlineAndFillCircleStart]"
print #main.graph, "when leftButtonMove [outlineAndFillCircleDraw]"
print #main.graph, "when leftButtonUp [outlineAndFillCircleFinish]"
wait
[outlineAndFillCircleStart]
startX = MouseX
startY = MouseY
startUY = MouseY - boxHeight
wait
[outlineAndFillCircleDraw]
count = count + 1
print #main.graph, "down ; color 220 220 220 ; size 0.5 ; place ";startX;" ";startY;" ; box ";MouseX;" ";MouseY;""
print #main.graph, "down ; color 220 220 220 ; size 0.5 ;place ";startX;" ";startUY;" ; box ";MouseX;" ";MouseY - boxHeight;""
if count mod 50 = 0 then print #main.graph, "discard ; redraw"
wait
[outlineAndFillCircleFinish]
endX = MouseX
endY = MouseY
endUY = MouseY - boxHeight
print #main.graph, "discard ; redraw"
print #main.graph, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2);" ; down ; color ";color$;" ; backcolor ";backcolora$;" ; size ";size;" ; ellipsefilled ";endX - startX;" ";endY - startY;""
print #main.graph, "place ";startX + ((endX - startX)/2);" ";(startY + ((endY- startY)/2)) - boxHeight;" ; down ; color black ; backcolor black ; ellipsefilled ";endX - startX;" ";endY - startY;""
print #spr, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2);" ; down ; color ";color$;" ; backcolor ";backcolora$;" ; size ";size;" ; ellipsefilled ";endX - startX;" ";endY - startY;""
print #spr, "place ";startX + ((endX - startX)/2);" ";(startY + ((endY- startY)/2)) - boxHeight;" ; down ; color black ; backcolor black ; ellipsefilled ";endX - startX;" ";endY - startY;""
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[fillCircle]
count = 0
print #main, "down ; place 850 580 ; color black ; size 2 ; box 950 780"
print #main, "place 870 610 ; color black ; size 2 ; box 930 650"
print #main, "place 870 660 ; color black ; backcolor lightgray ; boxfilled 930 700"
print #main, "place 870 710 ; color lightgray ; backcolor lightgray ; boxfilled 930 750"
print #main, "place 870 710 ; color darkblue ; box 930 750"
print #main, "flush"
print #main.graph, "when leftButtonDown [fillCircleStart]"
print #main.graph, "when leftButtonMove [fillCircleDraw]"
print #main.graph, "when leftButtonUp [fillCircleFinish]"
wait
[fillCircleStart]
startX = MouseX
startY = MouseY
startUY = MouseY - boxHeight
wait
[fillCircleDraw]
count = count + 1
print #main.graph, "place ";startX;" ";startY;" ; down ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY;""
print #main.graph, "place ";startX;" ";startUY;" ; down ; color 220 220 220 ; size 0.5 ; box ";MouseX;" ";MouseY - boxHeight;""
print #main, "place 100 ";(boxHeight * 2) + 300;" ; font helvetica 12 bold ; color black ; backcolor white ;\X = ";MouseX;" Y = ";MouseY;" "
if count mod 50 = 0 then print #main.graph, "discard ; redraw"
wait
[fillCircleFinish]
count = 0
endX = MouseX
endY = MouseY
endUY = MouseY - boxHeight
print #main.graph, "discard ; redraw"
print #main.graph, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2);" ; down ; color ";color$;" ; backcolor ";color$;" ; size ";size;" ; ellipsefilled ";endX - startX;" ";endY - startY;""
print #main.graph, "place ";startX + ((endX - startX)/2);" ";(startY + ((endY - startY)/2)) - boxHeight;" ;down ; color black ; backcolor black ; size ";size;" ; ellipsefilled ";endX - startX;" ";endUY - startUY;""
print #spr, "place ";startX + ((endX - startX)/2);" ";startY + ((endY - startY)/2);" ; down ; color ";color$;" ; backcolor ";color$;" ; size ";size;" ; ellipsefilled ";endX - startX;" ";endY - startY;""
print #spr, "place ";startX + ((endX - startX)/2);" ";(startY + ((endY - startY)/2)) - boxHeight;" ;down ; color black ; backcolor black ; size ";size;" ; ellipsefilled ";endX - startX;" ";endUY - startUY;""
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
wait
[airBrush]
count = 0
print #main, "down ; place 850 580 ; color white ; backcolor white ; size 2 ; boxfilled 950 780"
print #main.graph, "getbmp sprite 0 0 ";boxWidth;" ";boxHeight * 2;""
print #main.graph, "cls"
print #main.graph, "drawbmp sprite 0 0"
unloadbmp "sprite"
print #main.graph, "flush"
print #main.graph, "when leftButtonMove [drawAir]"
print #main.graph, "when leftButtonDown [drawAir]"
print #main.graph, "when leftButtonUp [drawAir]"
print #main.graph, "when rightButtonMove [drawAirB]"
print #main.graph, "when rightButtonDown [drawAirB]"
print #main.graph, "when leftButtonUp [drawAirB]"
wait
[drawAir]
scan
x = MouseX
y = MouseY
for X = 1 to size + 40
xa = int(rnd(1) * (size + 20)) + x
ya = int(rnd(1) * (size + 20)) + y
yau = ya - boxHeight
print #main.graph, "color ";color$;" ; down ; place ";xa;" ";ya;" ; size 1 ; go 1"
print #main.graph, "down ; color black ; place ";xa;" ";yau;" ; size 1 ; go 1"
print #spr, "color ";color$;" ; down ; place ";xa;" ";ya;" ; size 1 ; go 1"
print #spr, "down ; color black ; place ";xa;" ";yau;" ; size 1 ; go 1"
next X
wait
[quita]
timer 0
print #main.graph, "cls"
print #main, "cls"
print #main.graphRed, "cls"
print #main.graphGreen, "cls"
print #main.graphBlue, "cls"
close #main
close #spr
kill "";DefaultDir$;"\sprite.spr"
end
[drawAirB]
scan
x = MouseX
y = MouseY
for X = 1 to size + 40
xa = int(rnd(1) * (size + 20)) + x
ya = int(rnd(1) * (size + 20)) + y
yau = ya - boxHeight
print #main.graph, "color ";backcolora$;" ; down ; place ";xa;" ";ya;" ; size 1 ; go 1"
print #main.graph, "color black ; down ; place ";xa;" ";yau;" ; size 1 ; go 1"
print #spr, "color ";backcolora$;" ; down ; place ";xa;" ";ya;" ; size 1 ; go 1"
print #spr, "color black ; down ; place ";xa;" ";yau;" ; size 1 ; go 1"
next X
wait