Calendar Latest Topics

  Author   Comment  

Junior Member
Posts: 1
Reply with quote  #1 
I'm trying to create an animation of a ball moving across the screen, but would like to be able to control the position during a trial (through joystick or keyboard inputs, for example). I can't use the set_object_path function as it wouldn't allow my program to respond to changes within a trial, so I tried using the reposition_object within a for loop to try to create an animation. The basic structure of my code is something like

toggle object

for i = 1:totalframes
xpos = nextXPos
ypos = nextYpos 
reposition_object(object, xpos, ypos)

I've tried it with and without a short idle period at the end of the for loop and in every case the trial ends by the second iteration of the for loop. Am I doing something wrong? Is the reposition object function simply not meant to work this way? Is there possibly a better way to go about this? 

Posts: 971
Reply with quote  #2 
What is the version of your MonkeyLogic? The information you provided is not complete, but your logic looks valid. In fact, I just added an example task in my new NIMH ML release that does what you said in a similar way you described. You may want to try it.

Another option is to set "Subject cursor image" in the main GUI and add "showcursor('on');" in your timing file when you want to show the joystick cursor.
Previous Topic | Next Topic

Quick Navigation:

Easily create a Forum Website with Website Toolbox.