def __init__(self, scene, texto, callback=None, transparent=False): spyral.Sprite.__init__(self, scene) self.callback = callback self.anchor = 'center' self.pos = spyral.Vec2D(scene.size) / 2 self.margen = 5 self.layer = "primer" font_path = gamedir("../fonts/DejaVuSans.ttf") if transparent: self.font = spyral.Font(font_path, 20, (255, 255, 255)) self.font_red = spyral.Font(font_path, 20, (255, 0, 0)) self.line_height = self.font.linesize nueva = self.set_trans_text(texto) self.image = nueva self.scale = 2 else: self.font = spyral.Font(font_path, 14, (0, 0, 0)) self.line_height = self.font.linesize self.image = spyral.Image(filename=gamedir("imagenes/Menu_2.png")) nueva = self.set_text(texto) self.image.draw_image(nueva, position=(self.margen / 2, 0), anchor="midleft") if not transparent: spyral.event.register("input.mouse.down.left", self.go_callback) spyral.event.register("input.keyboard.down.return", self.go_callback) spyral.event.register("input.keyboard.down.space", self.go_callback)
def __init__(self, scene, texto, callback=None): spyral.Sprite.__init__(self, scene) self.callback = callback self.anchor = 'center' self.pos = spyral.Vec2D(scene.size) / 2 self.margen = 5 self.layer = "primer" self.image = spyral.Image(filename=gamedir("imagenes/Menu_2.png")) #self.image.draw_rect(color=(128,128,128), # position=(0,0), size=(self.height,self.width)) font_path = gamedir("../fonts/DejaVuSans.ttf") self.font = spyral.Font(font_path, 14, (0, 0, 0)) self.line_height = self.font.linesize nueva = self.set_text(texto) self.image.draw_image(nueva, position=(self.margen / 2, 0), anchor="midleft") spyral.event.register("input.mouse.down.left", self.go_callback) spyral.event.register("input.keyboard.down.return", self.go_callback) spyral.event.register("input.keyboard.down.space", self.go_callback)
def __init__(self, scene, topic=topic_dir): spyral.Sprite.__init__(self, scene) self.completo = False self.acertadas = " " self.layer = "abajo" self.ganadas = 0 self.perdidas = 0 spyral.event.queue("Tablero.score") self.topic = topic font_path = gamedir("../fonts/DejaVuSans.ttf") self.font = spyral.Font(font_path, 60, (0, 0, 0)) self.palabra, self.archivo_img = obtener_palabra(self.topic) self.text = self.palabra self.image = self.font.render("") self.anchor = 'midbottom' self.x = self.scene.width / 2 self.y = self.scene.height - 128 self.mostrar(self.text, "") spyral.event.register("input.keyboard.down.*", self.procesar_tecla, scene=self.scene) spyral.event.register("Tablero.reset.animation.end", self.reset, scene=self.scene) self.blup_snd = pygame.mixer.Sound(gamedir("sonidos/Randomize3.ogg")) self.hit_snd = pygame.mixer.Sound(gamedir("sonidos/Pickup_Coin.ogg"))
def __init__(self): Scene.__init__(self, SIZE) bg = spyral.Image(size=SIZE) bg.fill(BG_COLOR) self.background = bg font = spyral.Font(None, FONT_SIZE, FG_COLOR) self.title = TextSprite(self, font) self.title.anchor = 'center' self.title.pos = (SIZE[0] / 2, 30) self.title.render("N") self.block = Sprite(self) self.block.image = spyral.Image(size=(40, 40)) self.block.image.fill(FG_COLOR) self.block.y = 300 self.index = 0 self.set_animation() instructions = TextSprite(self, font) instructions.anchor = 'midbottom' instructions.x = 320 instructions.y = 470 instructions.render("n: next example p: previous example q: quit") # Register all event handlers spyral.event.register('system.quit', spyral.director.quit) spyral.event.register('input.keyboard.down.p', self.previous) spyral.event.register('input.keyboard.down.n', self.next) spyral.event.register('input.keyboard.down.q', spyral.director.quit) spyral.event.register('input.keyboard.down.escape', spyral.director.quit)
def __init__(self, scene, operator, digits): spyral.Sprite.__init__(self, scene) self.anchor = 'midbottom' if digits == 1: self.num1 = random.randint(1, 10) self.num2 = random.randint(1, 10) elif digits == 2: self.num1 = random.randint(10, 100) self.num2 = random.randint(10, 100) elif digits == 3: self.num1 = random.randint(100, 1000) self.num2 = random.randint(100, 1000) else: self.num1 = random.randint(1, 10000000) self.num2 = random.randint(1, 10000000) self.font = spyral.Font(DEF_FONT, 36) if operator == 'addition': self.answer = self.num1 + self.num2 self.image = self.font.render( str(self.num1) + "+" + str(self.num2) + "= ?") elif operator == 'multiplication': self.answer = self.num1 * self.num2 self.image = self.font.render( str(self.num1) + "x" + str(self.num2) + "= ?") elif operator == 'subtraction': self.answer = self.num1 - self.num2 self.image = self.font.render( str(self.num1) + "-" + str(self.num2) + "= ?") elif operator == 'division': checkdivision(self.num1, self.num2)
def __init__(self, scene): scene = spyral.director.get_scene() spyral.Sprite.__init__(self, scene) self.image = spyral.Image("images/minivintage-frame.png").scale((scene.width, scene.height)) # self.image.width = scene.width # self.image.height = scene.height self.width = scene.width self.height = scene.height self.pos = (0, 0) self.layer = "fondo" font_path = "fonts/new-century-schoolbook-bi-1361846783.ttf" self.font = spyral.Font(font_path, 28, (0,0,0)) self.line_height = self.font.linesize self.margen = 50 #self.miau = pygame.mixer.Sound("sounds/kipshu__prrmeow.wav") #self.miau.play() texto = sabiduria[self.count] self.image.draw_image(self.render_text(texto), position=(0, scene.height / 2)) #anchor="midleft") anim_aparecer = spyral.Animation("scale", spyral.easing.Linear(0.1, 1), duration=0.5) self.animate(anim_aparecer) RetroTexto.count += 1 if self.count == len(sabiduria): RetroTexto.count = 2
def __init__(self, frase, infodato, ganaste): spyral.Scene.__init__(self, SIZE) self.background = spyral.Image(size=SIZE).fill(BG_COLOR) self.text = frase font_path = "fonts/SFDigitalReadout-Medium.ttf" font = spyral.Font(font_path, 72, FG_COLOR) self.finale = spyral.Sprite(self) self.finale.image = font.render(self.text) self.finale.anchor = 'midtop' self.finale.x = SIZE[0] / 2 self.finale.y = 75 self.infodato_label = MultilineText(self, infodato, self.finale.x, 500, 1000, 500) if ganaste: animation = spyral.Animation('y', spyral.easing.Sine(50), shift=75, duration=3, loop=True) else: animation = spyral.Animation('x', spyral.easing.Sine(50), shift=self.finale.x, duration=3, loop=True) self.finale.animate(animation) spyral.event.register("input.keyboard.down.*", self.procesar_tecla) self.closing = False spyral.event.register("system.quit", spyral.director.quit)
def __init__(self, scene, text, color=(0, 0, 0)): spyral.Sprite.__init__(self, scene) self._font = spyral.Font(spyral._get_spyral_path() + os.path.join("resources", "fonts", "DejaVuSans.ttf"), 15, color) self._render(text)
def __init__(self): Scene.__init__(self) self.camera = self.parent_camera.make_child(SIZE) self.group = Group(self.camera) font = spyral.Font(None, FONT_SIZE, FG_COLOR) self.title = TextSprite(self.group, font) self.title.anchor = 'center' self.title.pos = (SIZE[0] / 2, 30) self.title.render("N") self.block = Sprite(self.group) self.block.image = spyral.Image(size=(40, 40)) self.block.image.fill(FG_COLOR) self.block.y = 300 self.index = 0 self.set_animation() instructions = TextSprite(self.group, font) instructions.anchor = 'midbottom' instructions.x = 320 instructions.y = 470 instructions.render("n: next example p: previous example q: quit")
def InitValues(self): if self.key == '-': self.image = tileBasic self.type = 'empty' self.amount = 0 elif self.key == '#': self.image = tileBush self.type = 'obstacle' self.amount = 0 #addition gates elif self.key == '1' or self.key == '2' or self.key == '3' or self.key == '4' or self.key == '5' or self.key == '6' or self.key == '7' or self.key == '8' or self.key == '9': self.amount = int(self.key) self.image = tileAdd self.type = 'add' self.textSprite = spyral.Sprite(self.parent) text = spyral.Font("game/fonts/DejaVuSans.ttf", 22, (0, 255, 0)) self.textSprite.x = self.x self.textSprite.y = self.y + 2 self.textSprite.anchor = 'center' self.textSprite.image = text.render(self.key) #subtraction gates elif self.key in subtractDict: self.amount = subtractDict[self.key] self.image = tileSubtract self.type = 'subtract' self.textSprite = spyral.Sprite(self.parent) text = spyral.Font("game/fonts/DejaVuSans.ttf", 22, (255, 0, 0)) self.textSprite.image = text.render(str(subtractDict[self.key])) self.textSprite.x = self.x self.textSprite.y = self.y + 2 self.textSprite.anchor = 'center' #go to next level gate elif self.key == 'G': self.image = tileGate self.type = 'gate' #other else: self.image = tileOther self.type = 'obstacle'
def __init__(self, scene, color): spyral.Sprite.__init__(self) self._font = spyral.Font( spyral._get_spyral_path() + os.path.join("resources", "fonts", "DejaVuSans.ttf"), 15, color) self._render(0, 0) self._update_in = 5 spyral.event.register("director.update", self._update, scene=scene)
def __init__(self, scene): spyral.Sprite.__init__(self, scene) self.image = spyral.Image(gamedir("images/golden-border.png")) self.layer = "abajo" self.font = spyral.Font(font_path, 28, (0, 0, 0)) self.line_height = self.font.linesize self.margen = 50 self.reset()
def __stylize__(self, properties): """ Applies the *properties* to this scene. This is called when a style is applied. :param properties: a mapping of property names (strings) to values. :type properties: ``dict`` """ self.font = spyral.Font(*properties.pop('font')) self._text = properties.pop('text', "Button") MultiStateWidget.__stylize__(self, properties)
def __init__(self, scene): super(Descartadas, self).__init__(scene) font_path = "fonts/SFDigitalReadout-Medium.ttf" self.font = spyral.Font(font_path, 72, GREY) self.image = self.font.render(scene.erradas) self.text = "" self.anchor = 'midtop' self.x = SIZE[0] / 6 self.y = 700
def __init__(self, scene, font, text, y): spyral.Sprite.__init__(self, scene) big_font = spyral.Font(font, 36) small_font = spyral.Font(font, 11) self.image = big_font.render(text) self.anchor = 'center' self.pos = scene.rect.center self.y = y guides = [("baseline", big_font.ascent), ("linesize", big_font.linesize)] for name, height in guides: self.image.draw_rect((0, 0, 0), (0, 0), (self.width, height), border_width=1, anchor='topleft') guide = Text(scene, small_font, name) guide.pos = self.pos guide.x += self.width / 2 guide.y += -self.height / 2 + height guide.anchor = 'midleft'
def __init__(self, texto): scene = spyral.director.get_scene() spyral.Sprite.__init__(self, scene) self.image = spyral.Image("images/minivintage-frame.png") font_path = "fonts/LiberationSans-Regular.ttf" self.font = spyral.Font(font_path, 24, (0,0,0)) self.line_height = self.font.linesize self.image.draw_image(self.render_text(texto), position=(0, 0), anchor="midleft")
def __init__(self, SIZE=None, activity=None, *args, **kwargs): spyral.Scene.__init__(self, SIZE) self.background = spyral.Image(size=self.size).fill((255, 255, 255)) self.title = spyral.Sprite(self) self.title.image = spyral.Font("fonts/SFDigitalReadout-Medium.ttf", 105).render("Consenso en 8-bits") self.title.anchor = "midbottom" self.title.pos = spyral.Vec2D(self.size) / 2 #anim = spyral.Animation("visible", spyral.easing.Iterate([True,False]), duration=0.5, loop=True) #self.title.animate(anim) self.subtitle = spyral.Sprite(self) self.subtitle.image = spyral.Font("fonts/SFDigitalReadout-Medium.ttf", 75).render("presiona espacio") self.subtitle.anchor = "midtop" self.subtitle.pos = spyral.Vec2D(self.size) / 2 self.player = Carrito(self, 1) self.player.pos = 150, 150 self.player.vel = 30 self.player.scale = 3 self.player = Carrito(self, 2) self.player.pos = self.width - 150, self.height - 150 self.player.vel = 30 self.player.scale = 3 self.angle = math.pi self.interruptores = [] spyral.event.register("input.keyboard.down.space", self.continuar) spyral.event.register("input.keyboard.down.*", self.mostrar) spyral.event.register("system.quit", spyral.director.pop) if activity: activity.box.next_page() activity._pygamecanvas.grab_focus() activity.window.set_cursor(None) self.activity = activity
def __init__(self, scene): spyral.Sprite.__init__(self, scene) self.font = spyral.Font(font_path, 28, (255, 255, 255)) self.anchor = "center" self.x = scene.width / 2 + random.randint(0, 300) - 150 self.layer = "primer" self.start_time = spyral.director.get_tick() # Asteroide self.asteroid_frames = [] self.target_frames = [] for i in range(0, 60): number = str(i).zfill(2) name = "Asteroid-A-10-" + number + ".png" self.asteroid_frames.append(spyral.Image( filename=gamedir("images/asteroid/" + name))) if int(i / 3) % 2 == 0: self.target_frames.append(spyral.Image(size=(75, 75))) else: self.target_frames.append(spyral.Image( filename=gamedir("images/asteroid/" + name))) m = spyral.Animation("image", spyral.easing.Iterate( self.asteroid_frames, 1), 5, loop=True) self.animate(m) # Boom self.explosion_full = spyral.Image( filename=gamedir("images/explosion.png")) self.explosion_frames = [] explosion_size = 205 self.explosion_frames.append( self.explosion_full.copy().crop((13 * explosion_size, 0), (explosion_size, explosion_size))) for i in range(0, 13): self.explosion_frames.append( self.explosion_full.copy().crop((i * explosion_size, 0), (explosion_size, explosion_size))) spyral.event.register("Lluvia.y.animation.end", self.finalizar, scene=self.scene) spyral.event.register("Lluvia.demora.animation.end", self.sonar_explosion) self.scale = 2 self.explotar_snd = pygame.mixer.Sound(gamedir("sonidos/Explosion.ogg")) self.alarm_snd = pygame.mixer.Sound(gamedir("sonidos/missile_alarm.ogg"))
def __init__(self, scene, text, style=None): spyral.Sprite.__init__(self, scene) font_path = "fonts/LiberationSans-Regular.ttf" if style=="title": self.font = spyral.Font(font_path, 48, (0,0,0)) elif style=="small": self.font = spyral.Font(font_path, 16, (0,0,0)) else: self.font = spyral.Font(font_path, 24, (0,0,0)) self.line_height = self.font.linesize self.margen = 30 text_width = self.font.get_size(text)[0] ancho_promedio = self.font.get_size("X")[0] caracteres = (scene.width - 2 * self.margen) / ancho_promedio self.lineas = self.wrap(text, caracteres).splitlines() self.altura = len(self.lineas) * self.line_height self.image = spyral.Image(size = (scene.width, self.altura)).fill((255,255,255)) self.image = self.render_text(text)
def __init__(self, SIZE, player): spyral.Scene.__init__(self, SIZE) self.background = spyral.Image(size=self.size).fill((255, 255, 255)) if player: self.player = Carrito(self, player) self.player.pos = spyral.Vec2D(self.width / 2, self.height / 3) self.player.vel = 0 self.player.scale = 3 self.interruptores = [] if player == 1: texto = "gana rojo" elif player == 2: texto = "gana verde" self.nota = spyral.Sprite(self) self.nota.image = spyral.Font("fonts/SFDigitalReadout-Medium.ttf", 105).render(texto) self.nota.anchor = "center" self.nota.pos = spyral.Vec2D(self.width / 2, 2 * self.height / 3) else: self.player = spyral.Sprite(self) self.player.image = spyral.Font( "fonts/SFDigitalReadout-Medium.ttf", 55).render("no hay consenso") self.player.anchor = "center" self.player.pos = spyral.Vec2D(self.size) / 2 self.aplauso = pygame.mixer.Sound('sounds/applause.wav') self.aplauso.play() anim = spyral.Animation("scale", spyral.easing.Sine(1), shift=2) self.player.animate(anim + anim + anim + anim + anim) spyral.event.register("Sprite.scale.animation.end", self.continuar) spyral.event.register("Carrito.scale.animation.end", self.continuar) spyral.event.register("system.quit", spyral.director.pop)
def __init__(self, scene): super(Tablero, self).__init__(scene) self.completo = False font_path = "fonts/LiberationSans-Regular.ttf" self.font = spyral.Font(font_path, 60, FG_COLOR) self.image = self.font.render("") self.text = "" self.anchor = 'midtop' self.x = SIZE[0] / 2 self.y = 75
def __init__(self, scene): super(Tablero, self).__init__(scene) self.completo = False font_path = "fonts/SFDigitalReadout-Medium.ttf" self.font = spyral.Font(font_path, 50, FG_COLOR) self.image = self.font.render("") self.text = "" self.anchor = 'midtop' self.x = SIZE[0]/2 self.y = 50
def checkAnswer(self): if int(self.my_form.AnswerInput.value) == self.currentQuestion.answer: print "CORRECT" self.feedback = TextInterface.TextInterface( self, spyral.Font(DEF_FONT, 50, (255, 0, 0)), (WIDTH / 2, 50), "Correct!") self.level += 1 self.speed += 5 self.feedback.kill() else: print "INCORRECT" self.feedback = TextInterface.TextInterface( self, spyral.Font(DEF_FONT, 50, (0, 255, 0)), (WIDTH / 2, 50), "Incorrect!") self.feedback.pos = (100, 100) self.feedback.kill() print("previous answer: " + str(self.currentQuestion.answer)) self.currentQuestion.kill() self.currentQuestion = Questions.Question(self, 'addition', 1) self.currentQuestion.pos = (WIDTH / 2, (HEIGHT)) print("new answer: " + str(self.currentQuestion.answer)) self.my_form.focus() print str(self.level)
def __init__(self, scene, text, x, y, w, h): super(MultilineText, self).__init__(scene) self.image = spyral.Image(size=(w, h)) font_path = "fonts/LiberationSans-Regular.ttf" self.font = spyral.Font(font_path, 24, FG_COLOR) self.line_height = self.font.linesize self.anchor = 'center' self.x = x self.y = y self.w = w self.h = h self.image = self.render_text(text) self.text = text
def __init__(self, menuScene, SIZE, filename): spyral.Scene.__init__(self, SIZE) self.background = spyral.Image(size=SIZE).fill((25, 150, 25)) self.menuScene = menuScene self.sceneSize = SIZE self.levelWidth = 20 self.levelHeight = 20 self.currentLevel = 1 self.goalAmount = 3 self.startLength = 1 self.levelData = self.CreateLevel(SIZE, filename) #create the text on the top of the screen that informs the player the length the snake needs #to be in order to progress to the next level self.hudGoalText = spyral.Sprite(self.parent) self.hudGoalStatus = spyral.Sprite(self.parent) self.text = spyral.Font("game/fonts/DejaVuSans.ttf", 22, (255, 255, 255)) self.hudGoalText.image = self.text.render( "The snake needs to be " + str(self.goalAmount) + " pieces long to go to the next level!") self.hudGoalText.x = SIZE[0] / 2 self.hudGoalText.y = self.text.get_size("X").y self.hudGoalText.anchor = 'center' #create snake player object self.player = snake.Snake(self, (2, self.levelWidth / 2)) spyral.event.register("input.keyboard.down.*", self.handleKeyboard, scene=self) self.hudGoalStatus.image = self.text.render( "The snake is currently " + str(self.player.bodyLength) + " pieces long!") self.hudGoalStatus.x = SIZE[0] / 2 self.hudGoalStatus.y = self.text.get_size("X").y * 2.1 self.hudGoalStatus.anchor = 'center'
def __init__(self, scene, texto): spyral.Sprite.__init__(self, scene) self.anchor = 'center' self.pos = spyral.Vec2D(scene.size) / 2 self.margen = 5 self.layer = "primer" self.image = spyral.Image(filename=gamedir("images/Menu_2.png")) #self.image.draw_rect(color=(128,128,128), # position=(0,0), size=(self.height,self.width)) font_path = gamedir("../fonts/DejaVuSans.ttf") self.font = spyral.Font(font_path, 24, (0, 0, 0)) self.line_height = self.font.linesize nueva = self.set_text(texto) self.image.draw_image(nueva, position=(self.margen / 2, 0), anchor="midleft") self.scale = 1.3
def __stylize__(self, properties): """ Applies the *properties* to this scene. This is called when a style is applied. :param properties: a mapping of property names (strings) to values. :type properties: ``dict`` """ pop = properties.pop self._padding = pop('padding', 4) self._nine_slice = pop('nine_slice', False) self._image_locations = {} self._image_locations['focused'] = pop('image_focused') self._image_locations['unfocused'] = pop('image_unfocused') self._cursor_blink_interval = pop('cursor_blink_interval', .5) self._cursor_color = pop('cursor_color', (0, 0, 0)) self._highlight_color = pop('highlight_color', (0, 140, 255)) self._highlight_background_color = pop('highlight_background_color', (0, 140, 255)) self.font = spyral.Font(*pop('font')) spyral.View.__stylize__(self, properties)
def __init__(self, scene, PALABRA="The Chakana Cross", ARCHIVO=None): # spritesheet color: yellow, green, orange, blue, brown spyral.Sprite.__init__(self, scene) self.layer = "arriba" self.PALABRA = PALABRA self.ARCHIVO = ARCHIVO self.font = spyral.Font(font_path, 28, (0, 0, 0)) self.line_height = self.font.linesize self.mode = "TARJETA" self.anchor = "center" self.margin = 15 self.marco = spyral.Image(filename=gamedir("imagenes/marco_1.png")) self.image = self.marco #self.scale = 1.2 self.pos = spyral.Vec2D(scene.size) / 2 self.showself()
def __init__(self): super(RaceScene, self).__init__(SIZE) global timeStart timeStart = time.time() self.isMoving = 0 #Start game with speed of 10 self.speed = 10 #Race distace is set to 100 self.raceDistance = 1000 self.currentDistance = 0 spyral.event.register('input.keyboard.down.esc', spyral.director.quit) spyral.event.register("system.quit", spyral.director.quit) if (Background_Music == True): Game_music.play(-1) self.background = spyral.Image("images/Background.png") self.level = 0 self.Chassis = Vehicle.Car(self) self.LeftWheel = Vehicle.Wheels(self) self.RightWheel = Vehicle.Wheels(self) self.Chassis.pos = (WIDTH / 4, (HEIGHT / 2) + 200) self.LeftWheel.pos.x = self.Chassis.pos.x - 100 self.LeftWheel.pos.y = self.Chassis.pos.y + 35 self.RightWheel.pos.x = self.Chassis.pos.x + 125 self.RightWheel.pos.y = self.Chassis.pos.y + 35 #playerVehicle = Vehicle.Vehicles(self) #playerVehicle.pos = (WIDTH/4, (HEIGHT/2)+200) animation = Animation('angle', easing.Linear(0, -2.0 * math.pi), duration=3.0, loop=True) self.RightWheel.animate(animation) self.LeftWheel.animate(animation) self.currentQuestion = Questions.Question(self, 'addition', 1) self.currentQuestion.pos = (WIDTH / 2, (HEIGHT)) class RegisterForm(spyral.Form): QuitButton = spyral.widgets.Button("Quit") AnswerInput = spyral.widgets.TextInput(100, "") Sound = spyral.widgets.Button("Sound") self.my_form = RegisterForm(self) self.my_form.focus() self.my_form.QuitButton.pos = ((WIDTH - 100), (HEIGHT - 50)) self.my_form.AnswerInput.pos = ((WIDTH / 2 + 150), (HEIGHT / 2) + 400) self.my_form.Sound.pos = ((WIDTH - 100), (HEIGHT - 850)) spyral.event.register('director.update', self.update) self.timeText = TextInterface.TextInterface( self, spyral.Font(DEF_FONT, 24, (255, 255, 255)), (WIDTH - 300, 100), str(time.time() - timeStart)) #Not sure why this is Car.y.animation and not Chassis.y.animation, but it works? spyral.event.register('Car.y.animation.end', self.endMoving) spyral.event.register("form.RegisterForm.QuitButton.clicked", self.goToMenu) spyral.event.register("input.keyboard.down.space", self.checkAnswer) spyral.event.register("input.keyboard.down.down", self.moveDown) spyral.event.register("input.keyboard.down.up", self.moveUp) spyral.event.register("form.RegisterForm.Sound.clicked", self.SwitchSound)
def __init__(self, scene, row, col, COLOR=4, PALABRA="error", ARCHIVO=None): # spritesheet color: yellow, green, orange, blue, brown spyral.Sprite.__init__(self, scene) self.layer = "arriba" self.COLOR = COLOR self.BGCOLOR = 4 self.RENDERED = None self.ROW = row self.COL = col self.PALABRA = PALABRA self.ARCHIVO = ARCHIVO self.font = spyral.Font(font_path, 22, (0, 0, 0)) self.line_height = self.font.linesize self.mode = "PALABRA" if Bloque.RENDERED and (PALABRA in Bloque.RENDERED): self.mode = "TARJETA" elif not Bloque.RENDERED: Bloque.RENDERED = [PALABRA] else: Bloque.RENDERED.append(PALABRA) # Somos un ojo del espacio assert COLOR != -1 self.full_image = spyral.Image( filename=gamedir("imagenes/eye-tiles.png")) self.anchor = "center" self.pos = (col * 140 + 70, row * 140 + 70) self.ARMADO = 3 self.CERRADO = 2 self.CERRANDO = 1 self.ABIERTO = 0 self.abierto = True self.oculto = False self.init_animations() self.margin = 2 self.marco = spyral.Image(filename=gamedir("imagenes/marco_1.png")) self.image = self.marco spyral.event.register("Bloque.blink", self.blink) spyral.event.register("Bloque.open", self.iopen) spyral.event.register("Bloque.final", self.final) spyral.event.register("input.mouse.down.left", self.check_click) spyral.event.register("Cursor.click", self.check_click) self.scale = 0.9 self.showself() self.MATCH = False