From 88e598926fd25d82f0946b190fe9784ac1d67b0f Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 30 Mar 2010 17:12:08 +0000 Subject: Commit inicial. --- diff --git a/circulo.png b/circulo.png new file mode 100755 index 0000000..723088e --- /dev/null +++ b/circulo.png Binary files differ diff --git a/circulo.wav b/circulo.wav new file mode 100755 index 0000000..b8790c8 --- /dev/null +++ b/circulo.wav Binary files differ diff --git a/cuadrado.png b/cuadrado.png new file mode 100755 index 0000000..694a0ac --- /dev/null +++ b/cuadrado.png Binary files differ diff --git a/cuadrado.py b/cuadrado.py new file mode 100755 index 0000000..c92e7c4 --- /dev/null +++ b/cuadrado.py @@ -0,0 +1,68 @@ +import pygame +from pygame.locals import * +from pygame.sprite import Sprite + +class Cuadrado(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("cuadrado.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Rectangulo(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("rectangulo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Circulo(Sprite): + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("circulo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Cubo(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("cubo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Triangulo(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("triangulo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Esfera(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("esfera.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass diff --git a/cuadrado.pyc b/cuadrado.pyc new file mode 100755 index 0000000..caca29f --- /dev/null +++ b/cuadrado.pyc Binary files differ diff --git a/cuadrado.py~ b/cuadrado.py~ new file mode 100755 index 0000000..c92e7c4 --- /dev/null +++ b/cuadrado.py~ @@ -0,0 +1,68 @@ +import pygame +from pygame.locals import * +from pygame.sprite import Sprite + +class Cuadrado(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("cuadrado.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Rectangulo(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("rectangulo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Circulo(Sprite): + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("circulo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Cubo(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("cubo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Triangulo(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("triangulo.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass + +class Esfera(Sprite): + + def __init__(self,x,y): + Sprite.__init__(self) + self.image = pygame.image.load("esfera.png").convert_alpha() + self.rect = self.image.get_rect() + self.rect.move_ip(x,y) + + def update(self): + pass diff --git a/cuadrado.wav b/cuadrado.wav new file mode 100755 index 0000000..d703fbe --- /dev/null +++ b/cuadrado.wav Binary files differ diff --git a/cubo.png b/cubo.png new file mode 100755 index 0000000..e827bd5 --- /dev/null +++ b/cubo.png Binary files differ diff --git a/cubo.wav b/cubo.wav new file mode 100755 index 0000000..c0be922 --- /dev/null +++ b/cubo.wav Binary files differ diff --git a/cudrado.py~ b/cudrado.py~ new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/cudrado.py~ diff --git a/esfera.png b/esfera.png new file mode 100755 index 0000000..513b197 --- /dev/null +++ b/esfera.png Binary files differ diff --git a/esfera.wav b/esfera.wav new file mode 100755 index 0000000..799138c --- /dev/null +++ b/esfera.wav Binary files differ diff --git a/figuras.py b/figuras.py new file mode 100755 index 0000000..10b28ca --- /dev/null +++ b/figuras.py @@ -0,0 +1,83 @@ +import pygame +from pygame.locals import * +from pygame.sprite import Sprite +from cuadrado import * + +pygame.mixer.init() +pygame.font.init() + + +salir = False + +screen = pygame.display.set_mode((640,480)) +pygame.display.set_caption("^__^") +fondo = pygame.image.load("fondo.png").convert_alpha() + +pygame.mouse.set_visible(True) + +sprites = pygame.sprite.OrderedUpdates() +cuadrado = pygame.sprite.Group() +rectangulo = pygame.sprite.Group() +triangulo = pygame.sprite.Group() +circulo = pygame.sprite.Group() +esfera = pygame.sprite.Group() +cubo = pygame.sprite.Group() + +cuadrado.add([Cuadrado(102, 340)]) +rectangulo.add([Rectangulo(397, 340)]) +triangulo.add([Triangulo(247, 340)]) +circulo.add([Circulo(20, 340)]) +esfera.add([Esfera(314, 340)]) +cubo.add([Cubo(182, 340)]) +sprites.add([cuadrado,rectangulo,triangulo,circulo,esfera,cubo]) +temporizador = pygame.time.Clock() + +while not salir: + sprites.update() + + m = pygame.mouse.get_pressed() + + if m[0] == 1: + + (mouse_x,mouse_y) = pygame.mouse.get_pos() + + if (mouse_x > 102 and mouse_x < 182) and (mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("cuadrado.wav") + glu.play() + + if(mouse_x > 397 and mouse_x < 477)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("rectangulo.wav") + glu.play() + + if(mouse_x > 247 and mouse_x < 327)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("triangulo.wav") + glu.play() + + if(mouse_x > 20 and mouse_x < 100)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("circulo.wav") + glu.play() + + if(mouse_x > 314 and mouse_x < 394)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("esfera.wav") + glu.play() + + if(mouse_x > 182 and mouse_x < 262)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("cubo.wav") + glu.play() + + + screen.blit(fondo,(0, 0)) + sprites.draw(screen) + pygame.display.flip() + + temporizador.tick(60) + # gestion de eventos + for e in pygame.event.get(): + if e.type == pygame.QUIT: + salir = True + elif e.type == pygame.KEYDOWN: + if e.unicode == 'q': + salir = True + elif e.unicode == 'f': + pygame.display.toggle_fullscreen() + diff --git a/figuras.py~ b/figuras.py~ new file mode 100755 index 0000000..698d7cd --- /dev/null +++ b/figuras.py~ @@ -0,0 +1,86 @@ +import pygame +from pygame.locals import * +from pygame.sprite import Sprite +from cuadrado import * + +pygame.mixer.init() +pygame.font.init() + + +salir = False + +screen = pygame.display.set_mode((640,480)) +pygame.display.set_caption("^__^") +fondo = pygame.image.load("fondo.png").convert_alpha() + +pygame.mouse.set_visible(True) + +sprites = pygame.sprite.OrderedUpdates() +cuadrado = pygame.sprite.Group() +rectangulo = pygame.sprite.Group() +triangulo = pygame.sprite.Group() +circulo = pygame.sprite.Group() +esfera = pygame.sprite.Group() +cubo = pygame.sprite.Group() + +cuadrado.add([Cuadrado(102, 340)]) +rectangulo.add([Rectangulo(397, 340)]) +triangulo.add([Triangulo(247, 340)]) +circulo.add([Circulo(20, 340)]) +esfera.add([Esfera(314, 340)]) +cubo.add([Cubo(182, 340)]) +sprites.add([cuadrado,rectangulo,triangulo,circulo,esfera,cubo]) +temporizador = pygame.time.Clock() + +while not salir: + sprites.update() + + m = pygame.mouse.get_pressed() + + if m[0] == 1: + + (mouse_x,mouse_y) = pygame.mouse.get_pos() + + if (mouse_x > 102 and mouse_x < 182) and (mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("cuadrado.wav") + n=pygame.image.load("ncuadrado.png") + re = n.get_rect() + re.move_ip(100,100) + glu.play() + + if(mouse_x > 397 and mouse_x < 477)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("rectangulo.wav") + glu.play() + + if(mouse_x > 247 and mouse_x < 327)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("triangulo.wav") + glu.play() + + if(mouse_x > 20 and mouse_x < 100)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("circulo.wav") + glu.play() + + if(mouse_x > 314 and mouse_x < 394)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("esfera.wav") + glu.play() + + if(mouse_x > 182 and mouse_x < 262)and(mouse_y > 340 and mouse_y < 420): + glu = pygame.mixer.Sound("cubo.wav") + glu.play() + + + screen.blit(fondo,(0, 0)) + sprites.draw(screen) + pygame.display.flip() + + temporizador.tick(60) + # gestion de eventos + for e in pygame.event.get(): + if e.type == pygame.QUIT: + salir = True + elif e.type == pygame.KEYDOWN: + if e.unicode == 'q': + salir = True + elif e.unicode == 'f': + pygame.display.toggle_fullscreen() + diff --git a/fondo.png b/fondo.png new file mode 100755 index 0000000..d145089 --- /dev/null +++ b/fondo.png Binary files differ diff --git a/ncirculo.png b/ncirculo.png new file mode 100755 index 0000000..0b76115 --- /dev/null +++ b/ncirculo.png Binary files differ diff --git a/ncuadrado.png b/ncuadrado.png new file mode 100755 index 0000000..b415214 --- /dev/null +++ b/ncuadrado.png Binary files differ diff --git a/ncubo.png b/ncubo.png new file mode 100755 index 0000000..d889e93 --- /dev/null +++ b/ncubo.png Binary files differ diff --git a/nesfera.png b/nesfera.png new file mode 100755 index 0000000..c89a4ab --- /dev/null +++ b/nesfera.png Binary files differ diff --git a/nrectangulo.png b/nrectangulo.png new file mode 100755 index 0000000..7042ae2 --- /dev/null +++ b/nrectangulo.png Binary files differ diff --git a/ntriangulo.png b/ntriangulo.png new file mode 100755 index 0000000..4a99509 --- /dev/null +++ b/ntriangulo.png Binary files differ diff --git a/rectangulo.png b/rectangulo.png new file mode 100755 index 0000000..ad9c315 --- /dev/null +++ b/rectangulo.png Binary files differ diff --git a/rectangulo.wav b/rectangulo.wav new file mode 100755 index 0000000..ca67c25 --- /dev/null +++ b/rectangulo.wav Binary files differ diff --git a/triangulo.png b/triangulo.png new file mode 100755 index 0000000..f375090 --- /dev/null +++ b/triangulo.png Binary files differ diff --git a/triangulo.wav b/triangulo.wav new file mode 100755 index 0000000..99fa508 --- /dev/null +++ b/triangulo.wav Binary files differ -- cgit v0.9.1