"System Builder": example of project


project Traffic [author] E.A.Eremin (Russia) [properties] name AbsObject object's name string parent AbsObject parent object type string image VisObject number of image integer 0 0 30 left VisObject X coordinate integer 0 -32 640 top VisObject Y coordinate integer 0 -32 480 width VisObject X size of object integer 32 4 630 height VisObject Y size of object integer 32 4 470 xstep MovObject x coordinate change integer 1 -50 50 ystep MovObject y coordinate change integer 1 -50 50 xsize MainObject x size of the window integer 200 100 640 ysize MainObject y size of the window integer 200 100 480 xpos MainObject x position of window integer 200 0 640 ypos MainObject y position of window integer 200 0 480 timer MainObject main counter integer 0 0 32760 wait stop wait on bus stop integer 0 0 50 count tl counter integer 0 0 16000 l_point tl left point of control integer 0 0 400 r_point tl right point of control integer 0 0 400 t_point tl top point of control integer 0 0 300 b_point tl bottom point of control integer 0 0 300 [methods] _main MainObject main method World.timer=World.timer+1;tl1._light;c1._hordrive;b1._hordrive;c2._verdrive;if b1.xstep<0;s1._wait;endif;if b1.xstep>0;s2._wait;endif _xmove MovObject horizontal move .left=.left+.xstep _ymove MovObject vertical move .top=.top+.ystep _light tl switch the light .count=.count+1;if .count=50;.image=2;endif;if .count=100;.image=3;endif;if .count=150;.image=2;endif;if .count=200;.image=1;.count=0;endif _hordrive transport horisontal movement if .xstep>0;._toright;else;._toleft;endif _toright transport movement to right if .left<>tl1.l_point;._xmove;else;if tl1.image=3;._xmove;endif;endif;if .left=World.xsize;.image=.image+1;.top=.top-50;.xstep=0-.xstep;endif _toleft transport movement to left if .left<>tl1.r_point;._xmove;else;if tl1.image=3;._xmove;endif;endif;if .left=-32;.image=.image-1;.top=.top+50;.xstep=0-.xstep;endif _verdrive transport vertical movement if .ystep>0;._todown;else;._totop;endif _todown transport movement to bottom if .top<>tl1.t_point;._ymove;else;if tl1.image=1;._ymove;endif;endif;if .top=World.ysize;.image=.image+1;.left=.left+50;.ystep=0-.ystep;endif _totop transport movement to bottom if .top<>tl1.b_point;._ymove;else;if tl1.image=1;._ymove;endif;endif;if .top=-32;.image=.image-1;.left=.left-50;.ystep=0-.ystep;endif _wait stop wait on bus stop if .left=b1.left;.wait=.wait+1;if .wait=10;.wait=0;else;b1.left=b1.left-b1.xstep;endif;endif [object types] AbsObject none abstract object MainObject AbsObject our virtual world VisObject AbsObject object with image MovObject VisObject moving object tl VisObject traffic light stop VisObject bus stop transport MovObject cars and buses car transport car bus transport bus [objects] World MainObject our virtual world xpos=150 ypos=160 xsize=400 ysize=300 timer=0 tl1 tl traffic light1 image=1 left=260 top=60 width=32 height=32 count=0 l_point=120 r_point=252 t_point=72 b_point=200 c1 car car1 image=13 left=0 top=160 width=32 height=32 step=4 xstep=4 ystep=0 b1 bus bus1 image=18 left=360 top=110 width=32 height=32 step=-4 xstep=-4 ystep=0 c2 car car2 image=21 left=160 top=0 width=32 height=32 step=4 xstep=0 ystep=4 s1 stop bus stop1 image=23 left=60 top=68 width=32 height=32 wait=0 s2 stop bus stop2 image=23 left=100 top=205 width=32 height=32 wait=0
1