%-------------------
%Visuals Start Here
%-------------------
put "Loading. Please Wait"
%ROAD SETTINGS
%Draws the Background
var dot : int
var col : int
View.Set ("offscreenonly")
%Declares red, green and blue variables
var r, g, b : int
%Loop allows you where to draw the dots
for x : 1 .. maxx
for y : 1 .. 400
%Randomize red colour
randint (r, 116, 146)
%Randomize green color
randint (g, 143, 170)
%Radomize blue colour
randint (b, 12, 23)
%RBG Set colour program allows to you to mix the colours
RGB.SetColour (2, r / 255.0, g / 255.0, b / 255.0)
%draws randomized dots
Draw.Line (x, y, x, y, 2)
end for
end for
View.Update
%-------ROAD________________
%Declares red, green and blue variables
var rr, gg, bb : int
%Loop allows you where to draw the dots
for x1 : 0 .. 640
for y1 : 66 .. 203
%Randomize red colour
randint (rr, 120, 140)
%Randomize green color
randint (gg, 120, 140)
%Radomize blue colour
randint (bb, 110, 140)
%RBG Set colour program allows to you to mix the colours
RGB.SetColour (20, rr / 255.0, gg / 255.0, bb / 255.0)
%draws randomized dots
Draw.Dot (x1, y1, 20)
end for
end for
View.Update
%Declares red, green and blue variables
var aa, ga, bsa : int
%Loop allows you where to draw the dots
for x1sa : 350 .. 475
for y1sa : 200 .. 400
%Randomize red colour
randint (aa, 120, 140)
%Randomize green color
randint (ga, 120, 140)
%Radomize blue colour
randint (bsa, 110, 140)
%RBG Set colour program allows to you to mix the colours
RGB.SetColour (20, aa / 255.0, ga / 255.0, bsa / 255.0)
%draws randomized dots
Draw.Dot (x1sa, y1sa, 20)
end for
end for
View.Update
%Declares red, green and blue variables
var rra, gga, bba : int
%Loop allows you where to draw the dots
for x1a : 95 .. 205
for y1a : 200 .. 400
%Randomize red colour
randint (rra, 120, 140)
%Randomize green color
randint (gga, 120, 140)
%Radomize blue colour
randint (bba, 110, 140)
%RBG Set colour program allows to you to mix the colours
RGB.SetColour (20, rra / 255.0, gga / 255.0, bba / 255.0)
%draws randomized dots
Draw.Dot (x1a, y1a, 20)
end for
end for
View.Update
%Declares red, green and blue variables
var rra1, gga1, bba1 : int
%Loop allows you where to draw the dots
for x1a1 : 365 .. 475
for y1a1 : 0 .. 95
%Randomize red colour
randint (rra1, 120, 140)
%Randomize green color
randint (gga1, 120, 140)
%Radomize blue colour
randint (bba1, 110, 140)
%RBG Set colour program allows to you to mix the colours
RGB.SetColour (20, rra1 / 255.0, gga1 / 255.0, bba1 / 255.0)
%draws randomized dots
Draw.Dot (x1a1, y1a1, 20)
end for
end for
%End of the program
View.Update
%Road Line
Draw.ThickLine (0, 195, 90, 195, 5, white)
Draw.ThickLine (195, 195, 350, 195, 5, white)
Draw.ThickLine (475, 195, maxx, 195, 5, white)
Draw.ThickLine (0, 75, 365, 75, 5, white)
Draw.ThickLine (479, 75, maxx, 75, 5, white)
%Road Line 2
%Road Drawings End
%---------
%TRAFFIC DRAWINGS
%Draws traffic lights Frame
drawfillbox (340, 290, 312, 215, 27)
drawline (334, 215, 334, 181, black)
drawfillbox (256, 61, 330, 30, 27)
drawbox (256, 61, 330, 30, black)
drawline (330, 30, 364, 30, black)
%Traffic Lights Lights
drawoval (325, 229, 7, 7, black)
drawoval (325, 250, 7, 7, black)
drawoval (325, 272, 7, 7, black)
drawoval (314, 45, 7, 7, black)
drawoval (294, 45, 7, 7, black)
drawoval (271, 45, 7, 7, black)
%Stop sign
%Draws stop sign
%Houses
%Draws blue house
drawfillbox (63, 218, 0, 400, blue)
drawline (63, 218, 0, 371, black)
%Draws ivory house
drawfillbox (500, 265, 640, 400, 89)
drawbox (500, 265, 640, 400, black)
drawline (499, 265, 584, 350, black)
drawline (584, 350, 639, 291, black)
drawline (584, 399, 584, 350, black)
%Draws velvet house
drawfillbox (495, 50, 640, 0, 133)
%Draws orange House
drawfillbox (5, 0, 160, 50, 52)
View.Update
%CAr1
%--------------------------
%----------CARS------------
%--------------------------
proc movcar
drawfillbox (5, 100, 80, 150, 64)
end movcar
movcar
var face : array 1 .. sizepic (0, 99, 85, 152) of int
process a
takepic (0, 99, 85, 152, face)
for x : 0 .. 308 by 3
drawpic (x, 100, face, 0)
delay (5)
exit when x = 308
end for
end a
%------CAr2-----------------
process movcar2
drawfillbox (390, 2, 455, 50, 64)
end movcar2
fork movcar2
fork a
var car : array 1 .. sizepic (380, 0, 456, 53) of int
takepic (380, 0, 456, 53, car)
for x : 0 .. 400
drawpic (380, x, car, 0)
delay (5)
exit when x = 98
end for
[/quote]
So I wanted to make it fancy and I used RGB Setcolour command and
I drew roads. Then I took a picture of the box and moved
it. But the program simply does not work. So, my question is, "How can I move the boxes like the example below?"
[quote]
drawfillbox (0,0,maxx,maxy,2)
drawfillbox (0,63,640,165,grey)
drawfillbox (350,0,460,165,grey)
%--------------------------
%----------CARS------------
%--------------------------
%----------CAR1----------
proc movcar
drawfillbox (5, 100, 80, 150, 64)
end movcar
movcar
var face : array 1 .. sizepic (0, 99, 85, 152) of int
process a
takepic (0, 99, 85, 152, face)
for x : 0 .. 308 by 3
drawpic (x, 100, face, 0)
delay (100)
exit when x = 308
end for
end a
%------CAr2-----------------
process movcar2
drawfillbox (390, 2, 455, 50, 64)
end movcar2
fork movcar2
fork a
var car : array 1 .. sizepic (380, 0, 456, 53) of int
takepic (380, 0, 456, 53, car)
for x : 0 .. 400
drawpic (380, x, car, 0)
delay (100)
exit when x = 98
end for
|