def __init__(self): viz.EventClass.__init__(self) self.done = viztask.Signal() self.callback(viz.BUTTON_EVENT, self.onButton) self.rowantext = """ Charactor Creation Enter Your Charactor's name: """ vizcam.PivotNavigate(center=[15, -10, 0], distance=70, sensitivity=[1.0, 1.0]) self.text_2D_world = viz.addText(self.rowantext, pos=[2, 2, 2], scene=2) self.myButton2 = viz.addButtonLabel('Done!', scene=2) #Add a button. self.myButton2.setPosition(.5, .5) #Set its position. self.myButton2.setScale(1, 1) #Scale it. #Add a text box. self.box = viz.addTextbox(scene=2) #self.box.message('default') #Make it twice as long. self.box.length(2) #Place it in window. self.box.setPosition(.5, .8) #Have it grow when text reaches its boundary. self.box.overflow(viz.OVERFLOW_GROW)
def __init__(self, index, x, y, z): self.index = index self.center = x, y, z self.sphere = vizshape.addSphere(0.1) self.sphere.setPosition(self.center) self.sphere.color(viz.WHITE) self.sensor = vizproximity.addBoundingSphereSensor(self.sphere, scale=1) self.signal = viztask.Signal() self.sound = viz.addAudio('{:02d}.wav'.format(index))
def expertise_maze(): # setup viewpoint and positioning yield setup_view() # declare globals global signal global collide_coords global movement_time global coordinate_array global maze # clear the coordinate array coordinate_array = array([]) # Setup the objection "collision" signal = viztask.Signal() collide_coords = end_coords # Show instructions and wait for user signal until they are removed instructions = viz.addText('Please navigate to the blue wall', viz.SCREEN) instructions.fontSize(42) instructions.setPosition(.5, .5) instructions.alignment(viz.TEXT_CENTER_CENTER) yield viztask.waitKeyDown('m') instructions.remove() # show user fixation cross yield display_fix() # Load the maze maze_name = maze_root + '.IVE' maze = viz.add(maze_name) maze.visible(viz.OFF) yield maze.visible(viz.ON) # enable all of the global events joy_timer.setEnabled(viz.ON) coor_timer.setEnabled(viz.ON) write_onkey.setEnabled(viz.ON) quit_onkey.setEnabled(viz.ON) pos_timer.setEnabled(viz.ON) # reset and start the clock movement_time = TickTockTimer() movement_time.StartTimer() # wait for "collision" signal yield signal.wait() #disable and quit disable() write_trial_data() maze.remove()
def __init__(self,win): viz.EventClass.__init__(self) self.callback(viz.BUTTON_EVENT,self.onButton) viz.cam.reset() vizcam.PivotNavigate(center=[15,-10,-2], distance=70, sensitivity=[1.0,1.0]) if win: self.text='CONRGATRULATIONS: YOU WON. Well, YOU WON this level. But there is only one level' else: self.text='YOU LOSE. Oh well.' self.text_2D_world = viz.addText(self.text,pos=[2, 2, 2],scene=4) #self.myButton = viz.addButtonLabel('Play Again',scene=4) #Add a button. #Weird Issue resetting scenes , disabling fo rnow #self.myButton.setPosition(.5,.) #Set its position. #self.myButton.setScale(1,1) #Scale it. self.done=viztask.Signal() self.myquit = viz.addButtonLabel('Quit Game',scene=4) #Add a button. self.myquit.setPosition(.5,.5) #Set its position. self.myquit.setScale(1,1) #Scale it. self.done=viztask.Signal() self.continu=False
def __init__(self): viz.EventClass.__init__(self) self.callback(viz.BUTTON_EVENT, self.onButton) self.rowantext = """ _____ _____ _ _ | __ |___ _ _ _ ___ ___ |__ |___ _____| |_|_|___ | -| . | | | | .'| | | __| . | | . | | -_| |__|__|___|_____|__,|_|_| |_____|___|_|_|_|___|_|___| _____ _ _ _____ _ _ | __|_ _ ___ _ _|_|_ _ ___| | | __|_ _|_|_| |___ |__ | | | _| | | | | | .'| | | | | | | | . | -_| |_____|___|_| \_/|_|\_/|__,|_| |_____|___|_|___|___| May 2004: Electrical and Computer Engineering Students work on a new bio-algorithm to create zombies for the Biology Department. July 2004: The Biology Department finds a major bug in the algorithm, and expects them to all die off, so he hides them under the Engineering Building. Feb 2014: The Zombies are still alive. Due to the Engineering Building sinking 6 inches, the Zombies are extremely uncomfortable and ESCAPE. Instructions: Fight off the zombies to get to the roof of the Engineering Building. From there, you will zipline to the Science Building where the Biology Department can give you a cure. Make sure to grab objects along the way, so you can increase your power and toughness GOOD LUCK. No pressure, just all of our lives depend on you """ vizcam.PivotNavigate(center=[15, -10, 0], distance=70, sensitivity=[1.0, 1.0]) self.text_2D_world = viz.addText(self.rowantext, pos=[2, 2, 2]) self.myButton = viz.addButtonLabel('continue', scene=1) #Add a button. self.myButton.setPosition(.5, .8) #Set its position. self.myButton.setScale(1, 1) #Scale it. self.done = viztask.Signal()
texts = {} #Set text showing on the squares for i in range(len(position)): if i <= 11 and i != 10: texts['text' + str(i)] = viz.addText(textList[str(i)].encode('utf-8'), parent=squares['square' + str(i)], pos=[0, 0, -0.1]) texts['text' + str(i)].font('Times New Roman') texts['text' + str(i)].color(viz.BLACK) texts['text' + str(i)].setScale([0.4, 0.4, 0.4]) texts['text' + str(i)].alignment(viz.TEXT_CENTER_CENTER) readyAnswer = vizinput.ask("If ready, press 'Yes'") # define a task sequence, stimulate action will execute until cue finish triggersignal = viztask.Signal() def stistage(): for i in range(len(position)): if i <= 11 and i != 10: squares['square' + str(i)].addAction( stiInitial(stimulationLength, frequence[i], phase[i], framerate)) else: squares['square' + str(i)].addAction( stiInitial(stimulationLength, frequence[10], phase[10], framerate)) yield None
# launch vizard and enable physics and joystick viz.go(viz.FULLSCREEN) viz.phys.enable() joy = vizjoy.add() # disable numpy array printing threshold set_printoptions(threshold='nan') # define globals coordinate_array = array([]) movement_time = 0 trial_number = 0 sub_trial_number = 0 collide_coords = [] subject_id_data = 0 signal = viztask.Signal() maze = '' maze_root = '' condition = 0 end_coords = () status = 0 time_signal = viztask.Signal() phase = '' trial_time = 0 trial_object = '' start_coords = () start_ori = () def get_subject_info():
import infoPanel import random import parameters import environment import windSpeed import logger import statistics import math hitPosition = -1 collided = False data = -1 positionList = [] # check if space is pressed and send signal which calls update movement s = viztask.Signal() vizact.onkeydown(' ', s.send) def onCollide(e): global hitPosition global collided if not collided: hitPosition = environment.point.getPosition() collided = True #print(environment.point.getPosition()) def createPositions(): if parameters.intro: return [