WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-24-2015, 07:21 PM
sportykourty sportykourty is offline
Member
 
Join Date: Mar 2015
Posts: 4
Question help with moving objects to different locations

Ok so I'm trying to have two different sized objects to randomly be in the hiding spot positions that I've put in my code. When i run the program the closet hiding spots work but I think the oxygen hiding spots are using the closet hiding spot coordinates so they are all wrong. can anyone help?

Code:
def MainTask():
	"""Top level task that controls the game"""

	# Display instructions and wait for key press to continue
	yield DisplayInstructionsTask()

	# List of hiding spots for pigeons
	CLOSET_HIDING_SPOTS = [
		 [-11832, 1250, -11706]
		,[-11001, 1250, -15297]
		,[-7000, 1250, -16800]
	]

	# List of hiding spots for pigeons
	OXYGEN_HIDING_SPOTS = [
		 [-5950,1650,-10700]
		,[-10000,1650,-16000]
		,[-10950,1650,-11500]
	]

	# Create panel to display trial results
	resultPanel = vizinfo.InfoPanel('',align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None)
	resultPanel.visible(False)

	while True:

		# Randomly choose hiding spots from list
		locations1 = random.sample(CLOSET_HIDING_SPOTS,TRIAL_COUNT)
		locations2 = random.sample(OXYGEN_HIDING_SPOTS,TRIAL_COUNT)
		
		location1 = random.sample(locations1,TRIAL_COUNT)
		location2 = random.sample(locations2,TRIAL_COUNT)

		# Reset score
		score = 0
		UpdateScore(score)

		# Go through each position
		for pos in locations1:

			# Perform a trial
			found = yield TrialTask(pos)

			# Update score and display status text
			if found:
				#viz.playSound('sounds/pigeon_catch.wav')
				score += 1
				UpdateScore(score)
				resultPanel.setText(TRIAL_SUCCESS)
			else:
				#viz.playSound('sounds/pigeon_fly.wav')
				viztask.schedule(FadeToGrayTask())
				resultPanel.setText(TRIAL_FAIL)

			#Display success/failure message
			resultPanel.visible(True)

			# Add delay before starting next trial
			yield viztask.waitTime(TRIAL_DELAY)
			resultPanel.visible(False)

			# Disable gray effect
			gray_effect.setEnabled(False)
		
		# Go through each position
		for pos in locations2:

			# Perform a trial
			found = yield TrialTask(pos)

			# Update score and display status text
			if found:
				#viz.playSound('sounds/pigeon_catch.wav')
				score += 1
				UpdateScore(score)
				resultPanel.setText(TRIAL_SUCCESS)
			else:
				#viz.playSound('sounds/pigeon_fly.wav')
				viztask.schedule(FadeToGrayTask())
				resultPanel.setText(TRIAL_FAIL)

			#Display success/failure message
			resultPanel.visible(True)

			# Add delay before starting next trial
			yield viztask.waitTime(TRIAL_DELAY)
			resultPanel.visible(False)

			# Disable gray effect
			gray_effect.setEnabled(False)

		#Display results and ask to quit or play again
		resultPanel.setText(RESULTS.format(score,2))
		resultPanel.visible(True)
		yield viztask.waitKeyDown(' ')
		resultPanel.visible(False)

viztask.schedule( MainTask() )
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving objects smoothly flip321 Vizard 5 12-21-2011 02:01 AM
Moving objects together imperialkat Vizard 2 02-17-2010 12:43 PM
Semi-circle array containing target and distractor objects ptjt255 Vizard 3 08-04-2009 03:09 AM
Moving multiple objects with ppt durf Vizard 1 02-10-2009 03:03 PM
Could not find plugin to load objects... halley Vizard 1 05-30-2006 11:01 AM


All times are GMT -7. The time now is 07:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC