Links und Funktionen
Sprachumschaltung

Navigationspfad


Inhaltsbereich

Skifahrer

Skifahrer

skifahrer.py — text/python-source, 1 KB (1995 bytes)

Dateiinhalt

from visual import *
from random import random
from threading import Thread

# Szene-Einstellungen
scene.userzoom = True           # User darf zoomen?
scene.userspin = True           # User darf rotieren?
scene.forward = (0,-5,10)         # Kameraposition
scene.autoscale = False         # Autoskalierung aktiv?
scene.range = 30               # 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 = False        # Vollbild? norm. False
scene.title = "Koordinaten"     # Fenstertitel
scene.width = 600              # Fensterbreite: norm. 200
scene.height = 600             # Fensterhoehe: norm 200
scene.x = 50                    # x-Koordinate d. Fensters: norm. 0
scene.y = 25                    # y-Koordinate d. Fensters: norm. 0




class skifahrer(Thread, frame):

    def __init__(self, pos=(5,10,-35)):
        Thread.__init__(self)
        frame.__init__(self)
        self.arm1 = cylinder(radius=(1),length=(4),axis=(-1,0,5),pos=(-5,10,-35),color=color.red,frame=self)
        self.arm2 = cylinder(radius=(1),length=(4),axis=(1,0,5),pos=(5,10,-35),color=color.red,frame=self)
        self.ski1 = box(pos=(3.5,-5,-25),height=(0.5),length=(15),axis=(0,0,5),width=(2),color=color.green,frame=self)
        self.ski2 = box(pos=(-3.5,-5,-25),height=(0.5),length=(15),axis=(0,0,5),width=(2),color=color.green,frame=self)


    def einsLinksFahren(self):
        self.x+=1
        
        
    def einsRechtsFahren(self):
        self.x-=1


        
if __name__ == "__main__":
    s1 = skifahrer()
    s1.start()

    while True:
        if scene.kb.keys:
            skk = scene.kb.getkey()
            if skk=="left":
                s1.einsLinksFahren()
            elif skk=="right":
                s1.einsRechtsFahren()
                

Funktionsleiste