var Length : int
var height, clr : int
View.Set ("graphics: 600;400") % set the screen size
clr := blue %makes starting color blue
var x, y, but : int % variable
var shape : string := " "
put " Hello, And welcome to Mini PAint!!! Its easy to dojust click on the shape you want then on the canvas"
put " Black button is the car, And redsquare button is the movie "
put " ENJOY"
delay (0000)
cls
proc main
Draw.FillBox (1, 1, 200, 500, grey) %cursor
Draw.Box (1, 1, 200, 500, black) %outline of cursor
Draw.Box (0, 0, 201, 501, black) % dark outline of cursor
Draw.FillMapleLeaf (10, 10, 60, 60, red) %box 1- mapleleaf
Draw.FillBox (70, 10, 120, 60, blue) %box 2- box
Draw.FillBox (110, 80, 170, 130, white) % eraser button
Draw.FillBox (40, 80, 100, 130, black) % Car Button
Draw.FillBox (50, 150, 10, 200, red)
Draw.FillOval (120, 170, 30, 30, green)
Draw.FillStar (130, 10, 180, 60, brightgreen) % Star Button
end main
main
proc car1 (x, y, Length, height, clr : int)
Draw.FillBox (x, y, x + Length, y + height, clr) % body of car
Draw.FillOval (x + Length div 4, y, height div 5, height div 5, black) % wheels
Draw.FillOval (x + 3 * Length div 4, y, height div 5, height div 5, black) % wheels
Draw.Arc (x + Length div 2, y + height, Length div 4, Length div 6, 0, 180, black) %roof of car
end car1 % end ofprocedure
proc pencil % start of procedure
Draw.FillOval (x, y, 1, 1, clr)
end pencil % end of procedure
proc colorboxes % start of procedure
var colr : int := 10
for x : 25 .. 100 by 10 %forloop for colors
for y : 200 .. 350 by 10 % for loop tomake colors
Draw.FillBox (x, y, x + 10, y + 10, colr)
colr += 1
end for
end for
Draw.Box (25, 360, 105, 200, black)
Draw.FillBox (110, 340, 120, 350, clr)
end colorboxes % end of procedure
proc star (x, y : int) % start of procedure
Draw.FillStar (x, y, x + 50, y + 50, clr)
end star % end opfprocedure
proc circle (x, y : int)
Draw.FillOval (x,y, 1, 1, clr)
end circle
proc mapleleaf (x, y : int) % start of procedure
Draw.FillMapleLeaf (x, y, 30, 30, clr)
end mapleleaf % end of procedure
proc box (x, y : int) %start of procedure
Draw.FillBox (x, y, x + 60, y + 60, clr)
end box % end of procedure
proc eraser (x, y : int) % start of procedure
Draw.FillBox (x, y, x + 100, y + 100, white)
end eraser % end of procedure
proc car (x, y, length, height, clr : int) % start of procedure
Draw.FillBox (x, y, x + length, y + height, clr) % body of car
Draw.FillOval (x + length div 4, y, height div 5, height div 5, black) % wheels
Draw.FillOval (x + 3 * length div 4, y, height div 5, height div 5, black)
Draw.Arc (x + length div 2, y + height, length div 4, length div 6, 0, 180, clr) %roof of car
end car % end of procedure
proc carErase (x, y, length, height, clr : int) % startr of proc
Draw.FillBox (x, y, x + length, y + height, clr) % body of car
Draw.FillOval (x + length div 4, y, height div 5, height div 5, black) % wheels
Draw.FillOval (x + 3 * length div 4, y, height div 5, height div 5, black)
Draw.Arc (x + length div 2, y + height, length div 4, length div 6, 0, 180, clr) %roof of car
end carErase %end or proc
proc house (x, y, size : int)
Draw.FillBox (x, y, x + size, y + size, red) % main house
Draw.Line (x, y + size, x + size div 2, y + 3 * size div 2, red) % roof
Draw.Line (x + size div 2, y + 3 * size div 2, x + size, y + size, red)
Draw.Fill (x + size div 2, y + size + 1, red, red) % fill in roof
end house
proc scene (x, y : int)
Draw.FillBox (x, y + maxy div 2, maxx, maxy, blue) % sky
Draw.FillBox (x, y, maxx, maxy div 2, green) % green
end scene
proc animation1 % car moves across screene
var speed : int := 5
scene (0, 0)
house (250, 120, 75)
house (350, 120, 75)
house (450, 120, 75)
for x : 0 .. maxx by speed
car (x, 60, 100, 40, brightred) % draw carin new spot
delay (50)
carErase (x, 60, 100, 40, green)
end for
end animation1
proc animation2
var x : int := 0
var speed : int := 5
scene (0, 0)
loop
car (maxx div 2 - 100, maxy div 4, 100, 40, brightred)
delay (75)
scene (0, 0)
house (x + maxx, 120, 75)
house (x + maxx, -100, 75)
house (x + maxx, -200, 75)
x := x - speed
if x < -maxx then
x := 0
end if
speed := speed + 5
exit when speed = 1005
put "you are tyravaling at ", speed, "km"
if speed = 1005 then
put " Oh No! You are travaling to fast go back to the drawing board!"
delay (500)
end if
end loop
end animation2
loop
colorboxes
loop % waiting for a click
Mouse.Where (x, y, but)
exit when but = 1
end loop
if x < 200 then % button clicked
if x >= 10 and x <= 60 and y >= 10 and y <= 60 then
shape := "mapleleaf"
elsif x >= 70 and x <= 120 and y >= 10 and y <= 60 then
shape := "box"
elsif x >= 130 and x <= 180 and y >= 10 and y <= 60 then
shape := " star"
elsif x >= 110 and x <= 170 and y >= 80 and y <= 130 then
shape := " eraser"
elsif x >= 40 and x <= 100 and y >= 80 and y <= 130 then
shape := " car1"
elsif x > 25 and x <= 100 and y >= 200 and y <= 350 then
clr := View.WhatDotColor (x, y) % color button selector
elsif x >= 10 and x <= 50 and y >= 150 and y <= 200 then
shape := "animation"
elsif x >= 90 and x <= 150 and y >= 140 and y <= 200 then
shape := "circle"
end if
Draw.FillOval (120, 170, 30, 30, green)
elsif x > 200 then % on the Drawing Pad
if shape = "mapleleaf" then
mapleleaf (x, y)
elsif shape = "box" then
box (x, y)
elsif shape = " eraser" then
eraser (x, y)
elsif shape = " star" then
star (x, y)
elsif shape = " car1" then
car1 (x, y, 100, 50, clr)
elsif shape = "animation" then
animation1
cls
animation2
elsif shape = "circle" then
circle (x, y)
end if
end if
main
colorboxes
end loop
|