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() )