Group: Administrators
Posts: 13K,
Visits: 104K
|
To prevent dots from overlapping, you pretty much have to divide the screen into some sort of grid of X (however many) *potential* positions. As for there being no maximum, that is a problem. As the number of dots on-screen grows with each key press, at some point they'll have to overlap because there simply isn't any uninhabited space left. Imagine, for example, that a participant decides to draw several hundred dots to the screen.
You also need to allow for some kind of response that indicates the participant wants to *stop* drawing dots to the screen.
That said, here's an example that illustrates the gist of the above. Press the spacebar to draw a dot. Press the Escape key to erase the screen and start a new "trial". There are 3 such "trials" in the example.
<defaults> / canvasaspectratio = (1,1) </defaults>
<values> / dotpos = 0 / dotx = 0 / doty = 0 / dotcount = 0 / jitterstep = 1% </values>
<expt> / blocks = [1=myblock] </expt>
<block myblock> / trials = [1-3=starttrial; ] </block>
<trial starttrial> / ontrialbegin = [list.dotpos.reset(); values.dotx=-10%; values.doty=-10%; values.dotcount=0;] / stimulusframes = [1=clearscreen] / branch = [trial.drawdot] / trialduration = 0 </trial>
<trial drawdot> / ontrialend = [if(trial.drawdot.response==57) { values.dotcount+=1; values.dotpos=list.dotpos.nextvalue; values.dotx=list.x.item(values.dotpos)+(values.jitterstep*list.randomjitter.nextvalue); values.doty=list.y.item(values.dotpos)+(values.jitterstep*list.randomjitter.nextvalue); } ] / stimulusframes = [1=dot, debug] / validresponse = (57, 1) / branch = [if (trial.drawdot.response!=1) trial.drawdot] </trial>
<shape dot> / shape = circle / color = red / size = (3%,3%) / hposition = values.dotx / vposition = values.doty / erase = false </shape>
<shape clearscreen> / shape = rectangle / size = (100%, 100%) / color = white / erase = false </shape>
<text debug> / items = ("Number of dots drawn: <%values.dotcount%>") / position = (50%, 2%) / erase = false </text>
<list dotpos> / items = (1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48) / selectionrate = trial </list>
<list randomjitter> / items = (-3,-2,-1, 1, 2, 3) / selectionrate = always / selectionmode = random / replace = true </list>
<list x> / items = (6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%, 6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%, 6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%, 6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%, 6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%, 6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%) </list>
<list y> / items = (8.33%, 8.33%, 8.33%, 8.33%, 8.33%, 8.33%, 8.33%, 8.33%, 25.00%, 25.00%, 25.00%, 25.00%, 25.00%, 25.00%, 25.00%, 25.00%, 41.67%, 41.67%, 41.67%, 41.67%, 41.67%, 41.67%, 41.67%, 41.67%, 58.33%, 58.33%, 58.33%, 58.33%, 58.33%, 58.33%, 58.33%, 58.33%, 75.00%, 75.00%, 75.00%, 75.00%, 75.00%, 75.00%, 75.00%, 75.00%, 91.67%, 91.67%, 91.67%, 91.67%, 91.67%, 91.67%, 91.67%, 91.67%) </list>
|