4 class Tajundra(pygame
.sprite
.Sprite
):
15 def __init__(self
, stage
):
18 pygame
.sprite
.Sprite
.__init
__(self
)
19 self
.image_right
= pygame
.image
.load('tajuA1.png')
20 self
.image_left
=pygame
.transform
.flip(self
.image_right
,True,False)
22 self
.imageb_right
= pygame
.image
.load('tajuA2.png')
23 self
.imageb_left
=pygame
.transform
.flip(self
.imageb_right
,True,False)
26 self
.image
=self
.image_right
27 self
.rect
= self
.image
.get_rect()
28 pos
=self
.stage
.simbolos
['@'][0]
29 self
.rect
.bottomright
= pos
30 self
.rect
=self
.rect
.move(self
.stage
.BlockSize
)
31 self
.x
,self
.y
,self
.w
,self
.h
=self
.rect
37 self
.image
=self
.image_left
39 self
.image
=self
.image_right
42 self
.image
=self
.imageb_left
44 self
.image
=self
.imageb_right
51 self
.rect
=self
.x
,self
.y
,self
.w
,self
.h
53 def draw(self
,screen
):
55 screen
.blit(self
.image
, self
.rect
)
63 self
.move(self
.dx
*ms
/1000.0,self
.dy
*ms
/1000.0)
64 self
.dx
/=1+0.1*ms
/1000.0
65 self
.dy
/=1+0.1*ms
/1000.0
68 def checkcell(self
,px
,py
):
69 sx
,sy
=self
.stage
.BlockSize
71 Pantalla
=self
.stage
.StageData
85 if y0
>=0 and y0
<len(Pantalla
):
86 if x0
>=0 and x0
<len(Pantalla
[y0
]):
87 return Pantalla
[y0
][x0
]
91 def checkpos(self
,ms
):
94 if ( (self
.checkcell(-8,0)!=' ' and self
.dx
>0) or
95 (self
.checkcell(+8,0)!=' ' and self
.dx
<0) ) :
96 self
.move(-self
.dx
*ms
/1000.0,0)
98 # Control de hundimiento
100 if self
.checkcell(+12,-3)!=' ' or self
.checkcell(-12,-3)!=' ':
105 elif self
.checkcell(0,+1)!=' ' and self
.dy
<0:
106 self
.move(0,-self
.dy
*ms
/1000.0)
110 if self
.checkcell(+10,-1)==' ' and self
.checkcell(-10,-1)==' ':
115 if self
.checkcell(+10,-2)!=' ' or self
.checkcell(-10,-2)!=' ':
119 self
.move(0,-self
.dy
*ms
/1000.0)
126 if self
.estado
!=t_estado
and self
.estado_ms
>200: