kiiixK
kiiick.py — text/python-source, 8 KB (8482 bytes)
Dateiinhalt
from visual import * from random import* from threading import Thread # Szene-Einstellungen scene.userzoom = True # User darf zoomen? scene.userspin = True # User darf rotieren? scene.forward = (-1,-1,-1) # Kameraposition scene.autoscale = False # Autoskalierung aktiv? scene.range = 20 # Kameraabstand von scene.center scene.center = (0,0,0) # Kamerablickpunkt: norm. (0,0,0) scene.up = (0,1,0) # Rotationsachse Kamera: norm. (0,1,0) scene.background = color.black # Hintergrundfarbe scene.fov = 1 # Kamerawinkeloeffnung: norm. 1 scene.fullscreen = True # Vollbild? norm. False scene.title = "Koordinaten" # Fenstertitel scene.width = 200 # Fensterbreite: norm. 200 scene.height = 200 # Fensterhoehe: norm 200 scene.x = 50 # x-Koordinate d. Fensters: norm. 0 scene.y = 25 # y-Koordinate d. Fensters: norm. 0 k = sphere (radius = 1, color = color.white, pos =(-1,0,0)) k.velocity = vector (0,0,1) l =[] l.append(k) print (l) b = box (pos =(0,-2,0), lenght = 400, width = 100, axis = (0,0,1)) # Spieler class ego(frame): def __init__(self): frame.__init__(self) #ArmRechts: self.OberarmRechts = cylinder (frame = self, pos = (-11.7, 5.8, 0), radius = (0.7), color = color.white, axis = (0,-2.5,0)) self.EllbogenRechts = sphere (frame = self, pos = (-11.7, 3.3, 0), radius = (0.7)) self.UnterArmRechts = cylinder (frame = self, pos = (-11.7, 3.3,0), radius = (0.7), axis = (1, 0, 3)) self.HandRechts = sphere (frame = self, pos = (-10.7, 3.3, 3), radius = (0.72)) #ArmLinks: self.OberarmLinks = cylinder(frame = self, pos = (-8.4, 5.8, 0), radius = (0.7), color = color.white, axis = (-1.5,-2.5,4)) self.HandLinks = sphere (frame = self, pos = (-9.9, 3.3, 4), radius = (0.72)) #Waffe self.WAFFE = cylinder (frame = self, pos = (-11.4, 4, -1), axis = (1.3, 1.5,7), radius = 0.4, color = color.black, opacity = (1)) self.WAFFENLAUF = cylinder (frame = self, pos = (-11.4, 3.5, -1),axis =(1.3, 1.5, 7), radius = 0.4, color = color.black, opacity = (01)) self.Waffenlaser = ring (frame = self, pos = (-10.1,5.4,6), axis = (1.3, 1.5, 7), radius = 0.4) self.Waffenkugel = sphere (frame = self, pos = (-10.1, 5.4, 6), radius= 0.2, color= color.red) self.Waffengriffhinten = cylinder (frame = self, pos =(-10.6, 5.1, 3), radius = (0.3),axis = (0,-2.7,0), color = color.black) self.Waffengriffvorne = cylinder (frame = self, pos =(-10.5, 3.9, 4), length = (2), radius = (0.3),axis = (0.2, 0.3, 1), color = color.black) self.visier = ring (frame = self, pos = (-10.3,5.9,5), axis = (1.3, 1.5, 7), radius = 0.3, color = color.black) #Koerper self.kopf = sphere(frame = self, pos = (-10, 10,0), radius = (2.5),opacity = (1)) self.haare = sphere(frame = self, pos = (-10, 10.1,-0.1), radius = (2.5), color= color.black, opacity = (1)) self.rechtesA = sphere (frame = self, pos = (-11,11,2.2), radius = (0.3), color = color.black) self.linkesA = sphere (frame = self, pos = (-9,11,2.2), radius = (0.3), color = color.black) self.Mund = ring (frame = self, pos =(-10,9.3,2.1), radius = (0.8), color = color.red, axis= (0,0,1)) self.Tshirt = cylinder(frame = self, pos = (-10, 2.5,0), radius = 1.2, color = (0.3,0.6,1), axis = (0,5,0)) self.Guertel = ring(frame = self, pos = (-10, 2.5, 0), radius = 1, axis = (0,1,0), color = color.black, thickness = 0.3) self.SchulterRechts = sphere(frame = self, pos =(-11.3, 6.1, 0), radius = 1.2, color = (0.3,0.6,1) ) self.SchulterLinks = sphere(frame = self, pos =(-8.7, 6, 0), radius = 1.2, color = (0.3,0.6,1), axis = (0,1.5,0)) self.hueftelinks = sphere(frame = self, pos =(-11.3, 0.5, 0), radius = 1.2, color = color.blue) self.huefterechts = sphere(frame = self, pos =(-8.7, 0.5, 0), radius = 1.2, color = color.blue, axis = (0,1.5,0)) self.Hosenbund = cylinder(frame = self, pos = (-10,1,0), radius = 1.2, color = color.blue, axis = (0,1.5,0)) self.HoseRechts = cylinder(frame = self, pos =(-11.3,0.5,0), axis = (0,-1.5,0), radius = 1.2, color = color.blue) self.HoseLinks = cylinder(frame = self, pos =(-8.7,0.5,0), axis = (0,-1.5,0), radius = 1.2, color = color.blue) self.BreinRechts = cylinder(frame = self, pos =(-11.3,-0.7,0), axis = (0,-4,0), radius = 1.1, color = color.white) self.BreinLinks = cylinder(frame = self, pos =(-8.7,-0.7,0), axis = (0,-4,0), radius = 1.1, color = color.white) self.Rucksack = box(frame = self, pos = (-10, 5.7, -1.2), color = color.black, length = 1.6, height = 2.2) self.ArmLinks = cylinder(frame = self, pos =(8.7,0.5,0), axis = (0,0,0), radius = 1.2, color = color.red) #Listeneintrag #Kugelx =self.Waffenkugel.pos.x # Kugely =self.Waffenkugel.pos.y #Kugelz =self.Waffenkugel.pos.z #liste.append( self.Waffenkugel.pos.x) # liste.append( self.Waffenkugel.pos.y) #liste.append( self.Waffenkugel.pos.z) #self.kugel = sphere (pos =(self.pos.x-10, self.pos.y+5.3, self.pos.z+6.3), color = color.yellow, opacity = 0.7, frame=self) #self.kugel.visible = False self.b = box (pos =(self.pos.x-10, self.pos.y+5.3, self.pos.z+6.3), color = color.yellow, opacity = 0.7, frame=self, axis = (1,1,1), length = 1, width = 1, height = 1) self.b2 = box (pos =(self.pos.x-10, self.pos.y+5.3, self.pos.z+6.3), color = color.yellow, opacity = 0.7, frame=self,axis = (1,2,1), length = 1, width = 1, height = 1) self.b3 = box (pos =(self.pos.x-10, self.pos.y+5.3, self.pos.z+6.3), color = color.yellow, opacity = 0.7, frame=self, axis = (2,1,0.1), length = 1, width = 1, height = 1) self.b4 = box (pos =(self.pos.x-10, self.pos.y+5.3, self.pos.z+6.3), color = color.yellow, opacity = 0.7, frame=self, axis = (0.1,0.7,0.1), length = 1, width = 1, height = 1) self.b5 = box (pos =(self.pos.x-10, self.pos.y+5.3, self.pos.z+6.3), color = color.yellow, opacity = 0.7, frame=self, axis = (1.8,0.5,0.1), length = 1, width = 1, height = 1) self.b.visible = False self.b2.visible = False self.b3.visible = False self.b4.visible = False self.b5.visible = False e1 = ego() class Kick(Thread): def __init__(self): Thread.__init__(self) def run (self): while True: rate (50) if e1.BreinLinks.color == color.white: e1.BreinLinks.axis.z = e1.BreinLinks.axis.z +0.4 e1.BreinLinks.axis.y = e1.BreinLinks.axis.y +0.4 #e1.BreinLinks.axis.x = e1.BreinLinks.axis.x +0.4 #e1.HoseLinks.axis.z = e1.HoseLinks.axis.z +0.4 #e1.HoseLinks.axis.y = e1.HoseLinks.axis.y +0.4 if e1.BreinLinks.axis.z >= 05: e1.BreinLinks.color = color.red print ("LALALALALAL") break class Sprung(Thread): def __init__(self): Thread.__init__(self) def run (self): while True: rate (50) if e1.pos.y < 8: print (e1.pos) e1.pos = e1.pos +(0,0.2,0) print (e1.pos.y) if e1.pos.y >= 8: k1 = Kick() k1.run() elif e1.BreinLinks.color == color.red: while True: rate (50) if e1.pos.y >= 0: e1.BreinLinks.axis.z = e1.BreinLinks.axis.z-0.13 e1.BreinLinks.axis.y = e1.BreinLinks.axis.y-0.13 print (e1.pos) e1.pos = e1.pos +(0,-0.2,0) e1.color = color.white e1.BreinLinks.color = color.white #### Muss auf leetaste gelegt werden s1 = Sprung() s1.run()