[Tutor PyCZ] Help
jak.petr na atlas.cz
jak.petr na atlas.cz
Úterý Únor 21 18:18:09 CET 2006
Mam problem v pythonu 2.4.2 a to ze mi to v jednom (jeste sice nedokoncenem ale mel by byt funkcni) programu hazi chybu kterou nechapu? Kod onoho programu je zde take. Prosim napiste mi co ta chyba znamena a jak se da opravit.
Děkuji
Kod:
import random
from livewires import *
begin_graphics()
allow_moveables()
def vyrobHrace():
global xh
global yh
xh=random.randint(0, 630)
yh=random.randint(0, 479)
Hrac_telo = circle( xh, yh, 5, filled=1)
sleep(1)
def posunHrace():
global klavesy
klavesy = keys_pressed()
if "8" in klavesy:
yh=yh+1
move_to(Hrac_telo, xh, yh)
sleep(1)
if "9" in klavesy:
xh=xh+1
yh=yh+1
move_to(Hrac_telo, xh, yh)
sleep(1)
if "7" in klavesy:
xh=xh-1
yh=yh+1
move_to(Hrac_telo, xh, yh)
sleep(1)
if "4" in klavesy:
xh=xh-1
move_to(Hrac_telo, xh, yh)
sleep(1)
if "6" in klavesy:
xh=xh+1
move_to(Hrac_telo, xh, yh)
sleep(1)
if "1" in klavesy:
xh=xh-1
yh=yh-1
move_to(Hrac_telo, xh, yh)
sleep(1)
if "2" in klavesy:
yh=yh-1
move_to(Hrac_telo, xh, yh)
sleep(1)
if "3" in klavesy:
yh=yh-1
xh=xh+1
move_to(Hrac_telo, xh, yh)
sleep(1)
vyrobHrace()
while 1:
posunHrace()
if "q" in klavesy:
break
end_graphics()
Další informace o konferenci Tutor