Schneemann_Anna
Schneemann.py — Python Source, 1 KB (1878 bytes)
Dateiinhalt
from visual import * scene.background=color.magenta scene.center=(0,1,0) #scene.stereo = "redcyan" class schnee(frame): def __init__(self,g=1, posx=0): frame.__init__(self) self.bauch=sphere(frame=self, pos=(posx,0,0), radius=0.8*g) self.brust=sphere(frame=self, pos=(posx,g*1,0), radius=0.6*g) self.kopf=sphere(frame=self, pos=(posx,g*1.8,0), radius=0.4*g) self.auger=sphere(frame=self, pos=(posx+0.1*g,g*1.8,g*0.4), radius=0.05*g, color = color.black) self.augel=sphere(frame=self, pos=(posx-0.1*g,g*1.8,g*0.4), radius=0.05*g, color = color.black) self.ring=ring(frame=self, pos=(posx,2*g,0), axis=(0,1,0), radius= 0.5*g, thickness=0.1*g, color = color.black) self.hut=cylinder(frame=self, pos=(posx,2*g,0), axis=(0,0.4*g,0), radius=0.4*g, thickness=0.1*g, color = color.black) self.nase=cone(frame=self, pos=(posx,g*1.75,0.4*g), axis=(0,0,0.25*g), radius=0.05*g, color = color.orange) self.knopf1=sphere(frame=self, pos=(posx,g*1.3,g*0.5*g), radius=0.04*g, color=color.black) self.knopf2=sphere(frame=self, pos=(posx,g*1.1,g*0.58*g), radius=0.05*g, color=color.black) self.knopf3=sphere(frame=self, pos=(posx,g*0.9,g*0.58*g), radius=0.055*g, color=color.black) berta = schnee(g=1, posx=0) #xaver = schnee(g=2, posx=-3) wandr = box(pos = vector(5,0,0), size=(0.01,5,3), color = color.cyan) wandl = box(pos = vector(-5,0,0), size=(0.01,5,3), color = color.cyan) scene.autoscale = False def wandern(wer): a = 0 for b in range(100): rate(7) if wer.x < wandr.x and a == 0: wer.x += 1 elif wer.x == wandr.x: a = 1 wer.x -= 1 elif wer.x > wandl.x and a == 1: wer.x -= 1 elif wer.x == wandl.x: a = 0 wer.x += 1 wandern(berta)