<br><font size=2 face="sans-serif">V bode 3 sa mi to nejako vyposunulo,
ma to byt takto</font>
<br>
<br><font size=2 face="Courier New">if kurzor.trefa(opicka):</font>
<br><font size=2 face="Courier New">&nbsp; print &quot;Tu je Opicka&quot;
&nbsp; &nbsp;</font>
<br><font size=2 face="Courier New">&nbsp; zasahZvuk.play()</font>
<br><font size=2 face="Courier New">&nbsp; opicka.zasah()</font>
<br><font size=2 face="Courier New">elif kurzor.trefa(kladivo):</font>
<br><font size=2 face="Courier New">&nbsp; print &quot;Tu je Kladivo&quot;
&nbsp; &nbsp;</font>
<br><font size=2 face="Courier New">&nbsp; zasahZvuk.play()</font>
<br><font size=2 face="Courier New">&nbsp; kladivo.zasah()</font>
<br><font size=2 face="Courier New">else:</font>
<br><font size=2 face="Courier New">&nbsp; netrafilZvuk.play()</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Roman Miklos &lt;RMiklos@pss.sk&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: tutor-bounces@py.cz</font>
<p><font size=1 face="sans-serif">10.10.2006 08:39</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Konference Tutor portalu PyCZ &lt;tutor@py.cz&gt;</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">Konference Tutor portalu
PyCZ &lt;tutor@py.cz&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Re: [Tutor PyCZ] Pygame -
zasahy a otočky (bylo:Re: &nbsp;Fw: HElP)</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
Pozrel som si ten program editor.py</font><font size=3> </font><font size=2 face="sans-serif"><br>
Neviem ci som dobre rozumel, ale asi chces, aby kladivo zareagovalo na
kliknutie tak ako opicka.</font><font size=3> </font><font size=2 face="sans-serif"><br>
Problem bol hlavne vo metode trefa(self, ciel) triedy Kurzor, ktora nemala
vzdy definovanu navratovu hodnotu, <br>
ale len ked bol atribut self.pohladenie = 0 a ty si sa rozhodoval na zaklade
navratovej hodnoty tej funkcie. <br>
Naco tam mas ten atribut self.pohladenie, je vobec k niecomu?</font><font size=3>
<br>
<br>
</font><font size=2 face="sans-serif"><br>
Takze urobil som toto:</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
1. upravil som metodu trefa() Kurzor-u takto:</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp;def trefa(self, ciel):</font><font size=3> </font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;vracia info,ak kurzor zasiahla ciel&quot;</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;# Je tu problem s atributom self.pohladenie
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# (neviem na aky ucel ma sluzit), <br>
 &nbsp; &nbsp; &nbsp; &nbsp;# ak self.pohladenie=1 funkcia nemala definovanu
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# navratovu hodnotu <br>
 &nbsp; &nbsp; &nbsp; &nbsp;#- zakomentoval som doleuvedeny if</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;#if not self.pohladenie:</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;self.pohladenie = 1</font><font size=3> </font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;zasahObd = self.rect.inflate(-5, -5)</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;return zasahObd.colliderect(ciel.rect)</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
2. Dodal triede Kladivo, tie iste metody ako ma trieda Opicka aby aj kladivo
mohlo vydavat zvuk a tocit sa.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
3. Vo funcii main() som trochu upravil rozhodovaci blok takto:</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if kurzor.trefa(opicka):</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;print &quot;Tu je Opicka&quot; &nbsp; &nbsp;</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zasahZvuk.play()</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;opicka.zasah()</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;elif kurzor.trefa(kladivo):</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;print &quot;Tu je Kladivo&quot; &nbsp; &nbsp;</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zasahZvuk.play()</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kladivo.zasah()</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else:</font><font size=3>
</font><font size=2 face="Courier New"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;netrafilZvuk.play()</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
Tu je cely opraveny program</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Skus to a napis, ci to malo byt tak, alebo nie.</font><font size=3> <br>
<br>
<br>
</font>
<table width=100%>
<tr valign=top>
<td width=38%><font size=1 face="sans-serif"><b>&quot;petrik&quot; &lt;petrik@extel.sk&gt;</b>
<br>
Sent by: tutor-bounces@py.cz</font><font size=3> </font>
<p><font size=1 face="sans-serif">09.10.2006 22:55</font><font size=3>
</font>
<br>
<table border=4 width=100%>
<tr valign=top>
<td width=100% bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Konference Tutor portalu PyCZ &lt;tutor@py.cz&gt;</font></div></table>
<p>
<td width=61%>
<table width=100%>
<tr>
<td width=13%>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td width=86% valign=top><font size=1 face="sans-serif">&quot;Konference
Tutor portalu PyCZ&quot; &lt;tutor@py.cz&gt;</font><font size=3> </font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Re: [Tutor PyCZ] &nbsp; &nbsp;
&nbsp; &nbsp;Pygame - zasahy a otočky (bylo:Re: &nbsp;Fw: HElP)</font></table>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=49%>
<td width=50%></table>
<br></table>
<br><font size=3><br>
<br>
<br>
</font>
<p><font size=2 face="Arial">Taže ... už ted chapu co přesne myslíš,snáď
taky raz budu umět takhle chapat tyhle veci .</font><font size=3> </font>
<p><font size=3><br>
<br>
umíš nadefinovat, vytvořit funkci, že když zavolám:</font><font size=3><tt><br>
<br>
mojeFunkce(&quot;hroch.txt&quot;, 12, 47)</tt></font><font size=3><br>
<br>
<br>
aby funkce vytiskla předané parametry ? To umíš? <br>
Jestli ano, tak použij to samé schéma na metodu __init__(....).... Akorát
že tam to nebudeš tisknout, ale ukládat do různých proměnných self.neco
....<br>
<br>
</font><font size=3><tt><br>
-- <br>
geon<br>
Pavel Kosina</tt></font>
<p>
<hr>
<p><font size=3>Mno jak jsem řikal ze tomu vicemene chapu ,tak uz ne :)
</font>
<p><font size=3>ale skusim na to jit pomalu . </font>
<p><font size=2 face="Arial"><i>class Opicka(pygame.sprite.Sprite):<br>
 &nbsp; def __init__(self, image ,<b>pozicie</i></b><i>):<br>
 &nbsp; &nbsp; &nbsp; pygame.sprite.Sprite.__init__(self) #<br>
 &nbsp; &nbsp; &nbsp; self.image, self.rect = nahrajObrazok(image)<br>
 &nbsp; &nbsp; &nbsp; obrazovka = pygame.display.get_surface()<br>
 &nbsp; &nbsp; &nbsp; self.oblast = obrazovka.get_rect()</i><br>
 &nbsp; &nbsp; &nbsp; </font><font size=3>&nbsp;</font>
<p><font size=2 face="Arial">Mno nevim jak vytisknout ty souradnice obrazku.
:/</font><font size=2><tt>_______________________________________________<br>
Tutor mailing list<br>
Tutor@py.cz<br>
http://www.py.cz/mailman/listinfo/tutor</tt></font><font size=3> </font>
<p><font size=2 face="sans-serif"><br>
Mgr. Ing. Roman MIKLÓŠ <br>
Prvá stavebná sporiteľňa a.s. <br>
Bajkalská 30, P. O. Box 48 <br>
829 48 &nbsp;Bratislava 25 <br>
Tel.: +421/ 2 / 582 31 174 <br>
Fax: +421/ 2 / 582 31 109 </font><font size=2><tt>_______________________________________________<br>
Tutor mailing list<br>
Tutor@py.cz<br>
http://www.py.cz/mailman/listinfo/tutor</tt></font>
<p><font size=2 face="sans-serif"><br>
Mgr. Ing. Roman MIKLÓŠ <br>
Prvá stavebná sporiteľňa a.s. <br>
Bajkalská 30, P. O. Box 48 <br>
829 48 &nbsp;Bratislava 25 <br>
Tel.: +421/ 2 / 582 31 174 <br>
Fax: +421/ 2 / 582 31 109 <br>
</font>