Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/DerechosSprites.py
diff options
context:
space:
mode:
Diffstat (limited to 'DerechosSprites.py')
-rw-r--r--DerechosSprites.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/DerechosSprites.py b/DerechosSprites.py
index 1d383ec..99b8056 100644
--- a/DerechosSprites.py
+++ b/DerechosSprites.py
@@ -3,6 +3,7 @@ import os
import random
import math
from AnimatedSprite import AnimatedSprite
+from DialogSprite import DialogSprite
STOP = 0
LEFT = 1
@@ -32,7 +33,6 @@ class MainSprite(AnimatedSprite):
dxs, dys, xini, yini, fps)
self.move = STOP
-
def do_move(self,grid):
if self.move == RIGHT:
@@ -195,12 +195,6 @@ class BoySprite(AnimatedSprite):
elif self.move == RIGHT:
self._frame = 24
- def draw_talking(self, screen):
- pygame.draw.arc(screen, (0, 0, 200), (self.x+9, self.y, 48, 48),
- -math.pi/4, math.pi/4, 2)
- pygame.draw.arc(screen, (0, 0, 200), (self.x+9, self.y, 48, 48),
- math.pi/4*3, math.pi/4*5, 2)
-
def collision_rect(self):
return (self.x+15, self.y+38, 38, 38)
@@ -214,7 +208,7 @@ def draw_grid(grid,screen):
if __name__ == "__main__":
- pygame.display.init()
+ pygame.init()
screen = pygame.display.set_mode((1200,900))
clock = pygame.time.Clock()
@@ -262,13 +256,13 @@ if __name__ == "__main__":
images.append(master_image.subsurface((0, 0, w, h)))
images.append(master_image.subsurface((0, h, w, h)))
fms = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1]
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]
nf = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 0]
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0]
dxs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0]
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
dys = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0]
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
sb = AnimatedSprite(images, fms, nf, dxs, dys, 0, 0, 10)
bg_image = pygame.image.load(os.path.join('images',
@@ -293,6 +287,12 @@ if __name__ == "__main__":
[1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1],
[1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1]]
+ font24 = pygame.font.Font(None, 24)
+
+ txts = ["Una prueba\ndel poder de las palabras",
+ "Y al que no le guste\nque se vaya\na donde ya sabe"]
+ dia = DialogSprite(txts, font24, 100, 100)
+
playing = True
talking_range = False
talking = False
@@ -319,14 +319,16 @@ if __name__ == "__main__":
elif event.key == pygame.K_SPACE and talking_range:
if not talking:
talking = True
+ dia.restart(sp2.rect())
sp.update_move(TALKING)
sp2.update_move(TALKING)
print("Talking...")
else:
- talking = False
- sp.update_move(STOP)
- sp2.update_move(STOP)
- print("Not talking...")
+ if not dia.update():
+ talking = False
+ sp.update_move(STOP)
+ sp2.update_move(STOP)
+ print("Not talking...")
elif event.key == pygame.K_ESCAPE:
playing = False
elif event.type == pygame.KEYUP:
@@ -414,7 +416,7 @@ if __name__ == "__main__":
sb.update(time_passed,grid)
sb.render(screen)
elif talking:
- sp2.draw_talking(screen)
+ dia.render(screen)
# sp.draw_rect(screen)