diff options
author | Sebastian Silva <icarito@lonko.(none)> | 2010-03-30 17:12:08 (GMT) |
---|---|---|
committer | Sebastian Silva <icarito@lonko.(none)> | 2010-03-30 17:12:08 (GMT) |
commit | 88e598926fd25d82f0946b190fe9784ac1d67b0f (patch) | |
tree | 64c8cf0d8d77e5b94e793d9888506ab45bd762da |
Commit inicial.
-rwxr-xr-x | circulo.png | bin | 0 -> 1385 bytes | |||
-rwxr-xr-x | circulo.wav | bin | 0 -> 86136 bytes | |||
-rwxr-xr-x | cuadrado.png | bin | 0 -> 370 bytes | |||
-rwxr-xr-x | cuadrado.py | 68 | ||||
-rwxr-xr-x | cuadrado.pyc | bin | 0 -> 3668 bytes | |||
-rwxr-xr-x | cuadrado.py~ | 68 | ||||
-rwxr-xr-x | cuadrado.wav | bin | 0 -> 118392 bytes | |||
-rwxr-xr-x | cubo.png | bin | 0 -> 2154 bytes | |||
-rwxr-xr-x | cubo.wav | bin | 0 -> 102008 bytes | |||
-rwxr-xr-x | cudrado.py~ | 0 | ||||
-rwxr-xr-x | esfera.png | bin | 0 -> 2809 bytes | |||
-rwxr-xr-x | esfera.wav | bin | 0 -> 120440 bytes | |||
-rwxr-xr-x | figuras.py | 83 | ||||
-rwxr-xr-x | figuras.py~ | 86 | ||||
-rwxr-xr-x | fondo.png | bin | 0 -> 9937 bytes | |||
-rwxr-xr-x | ncirculo.png | bin | 0 -> 1027 bytes | |||
-rwxr-xr-x | ncuadrado.png | bin | 0 -> 1248 bytes | |||
-rwxr-xr-x | ncubo.png | bin | 0 -> 949 bytes | |||
-rwxr-xr-x | nesfera.png | bin | 0 -> 1210 bytes | |||
-rwxr-xr-x | nrectangulo.png | bin | 0 -> 1736 bytes | |||
-rwxr-xr-x | ntriangulo.png | bin | 0 -> 1341 bytes | |||
-rwxr-xr-x | rectangulo.png | bin | 0 -> 411 bytes | |||
-rwxr-xr-x | rectangulo.wav | bin | 0 -> 95864 bytes | |||
-rwxr-xr-x | triangulo.png | bin | 0 -> 909 bytes | |||
-rwxr-xr-x | triangulo.wav | bin | 0 -> 69240 bytes |
25 files changed, 305 insertions, 0 deletions
diff --git a/circulo.png b/circulo.png Binary files differnew file mode 100755 index 0000000..723088e --- /dev/null +++ b/circulo.png diff --git a/circulo.wav b/circulo.wav Binary files differnew file mode 100755 index 0000000..b8790c8 --- /dev/null +++ b/circulo.wav diff --git a/cuadrado.png b/cuadrado.png Binary files differnew file mode 100755 index 0000000..694a0ac --- /dev/null +++ b/cuadrado.png 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 Binary files differnew file mode 100755 index 0000000..caca29f --- /dev/null +++ b/cuadrado.pyc 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 Binary files differnew file mode 100755 index 0000000..d703fbe --- /dev/null +++ b/cuadrado.wav diff --git a/cubo.png b/cubo.png Binary files differnew file mode 100755 index 0000000..e827bd5 --- /dev/null +++ b/cubo.png diff --git a/cubo.wav b/cubo.wav Binary files differnew file mode 100755 index 0000000..c0be922 --- /dev/null +++ b/cubo.wav 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 Binary files differnew file mode 100755 index 0000000..513b197 --- /dev/null +++ b/esfera.png diff --git a/esfera.wav b/esfera.wav Binary files differnew file mode 100755 index 0000000..799138c --- /dev/null +++ b/esfera.wav 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 Binary files differnew file mode 100755 index 0000000..d145089 --- /dev/null +++ b/fondo.png diff --git a/ncirculo.png b/ncirculo.png Binary files differnew file mode 100755 index 0000000..0b76115 --- /dev/null +++ b/ncirculo.png diff --git a/ncuadrado.png b/ncuadrado.png Binary files differnew file mode 100755 index 0000000..b415214 --- /dev/null +++ b/ncuadrado.png diff --git a/ncubo.png b/ncubo.png Binary files differnew file mode 100755 index 0000000..d889e93 --- /dev/null +++ b/ncubo.png diff --git a/nesfera.png b/nesfera.png Binary files differnew file mode 100755 index 0000000..c89a4ab --- /dev/null +++ b/nesfera.png diff --git a/nrectangulo.png b/nrectangulo.png Binary files differnew file mode 100755 index 0000000..7042ae2 --- /dev/null +++ b/nrectangulo.png diff --git a/ntriangulo.png b/ntriangulo.png Binary files differnew file mode 100755 index 0000000..4a99509 --- /dev/null +++ b/ntriangulo.png diff --git a/rectangulo.png b/rectangulo.png Binary files differnew file mode 100755 index 0000000..ad9c315 --- /dev/null +++ b/rectangulo.png diff --git a/rectangulo.wav b/rectangulo.wav Binary files differnew file mode 100755 index 0000000..ca67c25 --- /dev/null +++ b/rectangulo.wav diff --git a/triangulo.png b/triangulo.png Binary files differnew file mode 100755 index 0000000..f375090 --- /dev/null +++ b/triangulo.png diff --git a/triangulo.wav b/triangulo.wav Binary files differnew file mode 100755 index 0000000..99fa508 --- /dev/null +++ b/triangulo.wav |