%jumping_cross.m % PRESENTS A JUMPING CROSS IN FIVE LOCATIONS (FIXATION PLUS 2 ON LEFT AND 2 ON RIGHT) % VERTICAL POSITION AND WIDTH OF JUMPS CAN BE CONTROLLED %%%%JUMPING CROSS PARAMETERS**** gr=0.5; %CROSS COLOUR (0 IS BLACK AND 1 IS WHITE) crosssize=15; %MEASURED IN PIXELS verticalposition= -215 ; %ZERO IS MIDDLE OF SCREEN AND POSITIVE NUMBERS ARE ABOVE THIS POINT. inner=20; %determines how far the cross jumps outer=2*inner; fixtime=1200; %MILLISECONDS IN EACH CROSS POSITION jump_sequence=[0 inner 0 -inner 0 outer 0 -outer 0] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% config_display(1, 2, [0 0 0], [1,1,1], 'Helvetica', 10, 3, 0); config_keyboard(10,1,'nonexclusive');% default is without arguments and = config_keyboard( 100, 5, 'nonexclusive') start_cogent %%%%%%%%%DRAWING PARAMETERS%%%%%%%%%%%% gr=0.5; cgpenwid(1)% cr=(crosssize-1)/2; %DRAW A grey cross centred + %NB:/LINE ENDPOINTS END AT THE PIXEL BEFORE LAST crx=[-cr,-cr,-cr,0,-1,1]; cry=[0,-1,1,cr,cr,cr]; crx2=[cr+1,cr+1,cr+1,0,-1,1]; cry2=[0,-1,1,-cr-1,-cr-1,-cr-1]; %sprite 5 is the fixation cross cgmakesprite(5,crosssize,crosssize,0,0,0); cgsetsprite(5); cgpencol(gr,gr,gr); cgdraw(crx,cry,crx2,cry2); %actually drawing the cross into a sprite cgsetsprite(0);%must start with this if previously been drawing sprite. This returns destination to offscreen area for i=1:length(jump_sequence) cgdrawsprite(5,jump_sequence(i),verticalposition); if i > 1 waituntil(teye+fixtime); end teye=1000*cgflip(0,0,0); %cgflip output given in seconds end waituntil(teye+fixtime); stop_cogent