Exemple #1
0
 def update(self):
     self.body.setPos(self.x, self.y)
     phi = radians(90 - self.angle)
     self.head.setPos(self.x + 5 * cos(phi), self.y - 5 * sin(phi))
     risar.obnovi()
     if self.pause:
         self.wait(self.pause)
Exemple #2
0
 def update(self):
     phi = radians(90 - self.angle)
     self.body.setPos(self.x, self.y)
     self.head.setPos(self.x + 5 * cos(phi), self.y + 5 * sin(phi))
     risar.obnovi()
     if self.pause:
         self.wait(self.pause)
Exemple #3
0
 def run(self):
     self.check_placed()
     if self.hit or self.placed:
         pass
     else:
         self.hit_wall()
         self.position()
         risar.obnovi()
     sleep(0.002)
Exemple #4
0
def naloga10_pot():
    kraji = TestBase.kraji
    pov = dvosmerno(povezave(5, kraji))
    koord = koordict(kraji)
    pot = najkrajsa_pot("Škofije", "Lenart", pov)

    risar.obnavljaj = False
    narisi_povezave(kraji)
    for kraj1, kraj2 in zip(pot, pot[1:]):
        x1, y1 = koord[kraj1]
        x2, y2 = koord[kraj2]
        risar.crta(tx(x1), ty(y1), tx(x2), ty(y2), barva=risar.zelena, sirina=3)
    narisi_kraje(TestBase.kraji)
    risar.obnavljaj = True
    risar.obnovi()
    risar.stoj()
import risar
from random import randint, choice
Ax, Ay = 10, 475
Bx, By = 537, 475
Cx, Cy = 271, 10

desetnik = [(10, 475), (537, 475), (271, 10)]
x = 100
y = 200

risar.obnavljaj = False
for i in range(10000):
    dx, dy = choice(desetnik)
    x = (x + dx) / 2
    y = (y + dy) / 2
    risar.tocka(x, y)
risar.obnovi()
risar.stoj()