singleplayer
singleplayer.py — Python Source, 1 KB (2034 bytes)
Dateiinhalt
from visual import * from bricks import * from player import * from ball import * scene.title="PongVPong" scene.autoscale=False scene.fullscreen=True scene.userspin=False scene.userzoom=False scene.fov = 0.5 * math.pi player0 = player() ball = ball() ball.velocity = vector(0.1, 0.1, 0) run = False pause1 = box( height = 5, length = 1, pos=(1,0,0),visible = True) pause2 = box( height = 5, length = 1, pos=(-1,0,0),visible = True) world = world() world.worldgen() while True: rate(200) if run: if scene.kb.keys: s_ = scene.kb.getkey() player0.move(True, s_) if s_ == " ": run = False pause1.visible = True pause2.visible = True else: player0.move(False, "") ball.collision(player0, world) else: if scene.kb.keys: d = scene.kb.getkey() player0.move(True, d) if d == " ": run = True pause1.visible = False pause2.visible = False break else: player0.move(False, "") while True: rate(200) if run: if scene.kb.keys: s_ = scene.kb.getkey() player0.move(True, s_) if s_ == " ": run = False pause1.visible = True pause2.visible = True else: player0.move(False, "") ball.collision(player0, world) else: if scene.kb.keys: d = scene.kb.getkey() # player0.move(True, d) if d == " ": run = True pause1.visible = False pause2.visible = False elif d == "h": player0.increase() elif d == "j": player0.decrease() elif d == "k": player0.fast() elif d == "l": player0.slow() else: player0.move(False, "")