SP3IIL93
Jan 02, 2013 - 09:26
import sound
from scene import *
from random import random
from random import choice
from colorsys import hsv_to_rgb
sound.load_effect('Boing_1')
s1=['Piano_C3','Piano_E3','Piano_G3']
s2=['Piano_D3','Piano_F3','Piano_A3']
s3=['Piano_E3','Piano_G3','Piano_B3']
s4=['Piano_F3','Piano_A3','Piano_C4']
s5=['Piano_G3','Piano_B3','Piano_D4']
s6=['Piano_A3','Piano_C4','Piano_E4']
s7=['Piano_B3','Piano_D4','Piano_F4']
########PROBLEM HERE########
random_note=['s1','s2','s3','s4','s5','s6','s7']
class Particle (object):
def __init__(self, location):
self.location = location
class Particles (Scene):
def setup(self):
self.show_instructions = True
self.particles = set()
self.p_size = 64 if self.size.w > 700 else 32
def should_rotate(self, orientation):
return True
def touch_began(self, touch):
if self.show_instructions:
self.show_instructions = False
particle = Particle(touch.location)
self.particles.add(particle)
sound.play_effect(choice(random_note))
########AND HERE########
def draw(self):
background(1, 1, 1)
if self.show_instructions:
s = 40 if self.size.w > 700 else 17
text('Touch here.',
'Futura', s, *self.bounds.center().as_tuple())
dead = set()
for particle in self.particles:
s = 20
x, y = particle.location.as_tuple()
image('Musical_Notes', x - s/2, y - s/2, s, s)
run(Particles())