J&R Anna
Jump&Run.py — Python Source, 1 KB (1401 bytes)
Dateiinhalt
from visual import * #boden = box(pos=(0,0,0), size=(300,1,300)) #kasten = box(pos=(0,0,0),size=(100,80,40), axis=(0,-1,-1)) class figur(frame): def __init__(self,g=1,posx=0, farbe=color.white): frame.__init__(self) self.kopf=sphere(frame=self, pos=(posx,44*g,0), radius=15*g, color = farbe) self.koerper=box(frame=self, pos=(posx,0,0), size=(40*g,60*g,25*g), color = farbe) self.beinr=box(frame=self, pos=(posx+10*g,-40*g,0), size=(15*g,30*g,15*g), color= farbe) self.beinl=box(frame=self, pos=(posx-10*g,-40*g,0), size=(15*g,30*g,15*g), color= farbe) """def gehen(wer): if scene.kb.keys: taste = scene.kb.keys print(taste) if taste == "up": rate(20) wer.z += 1""" figur1 = figur(g=1, posx=0, farbe = color.red) figur2 = figur(g=0.5, posx=50, farbe = color.green) #gehen(figur1) while True: rate(20) if scene.kb.keys: taste = scene.kb.getkey() if taste == "w": figur1.z -= 10 elif taste == "s": figur1.z += 10 elif taste == "d": figur1.x += 10 elif taste == "a": figur1.x -= 10 elif taste == " ": for a in range(5): rate(30) figur1.y += 6 rate(3) for b in range(5): rate(30) figur1.y -= 6