import pygame as pg
import sys as sy
import numpy as np
game = True
width = 900
height = 600
screen = pg.display.set_mode((width, height))
pg.display.set_caption("UCBG")
def main_menu():
while game:
screen.fill((0, 0, 0))
pg.font.init()
font = pg.font.SysFont("freemonospaced", 35)
font_surf = font.render("UCBG", True, (255, 255, 255))
screen.blit(font_surf, (width / 2 - 50, height / 2 - 100))
# sine wave
Ys = []
t = 0
r = 100
xs, ys = 0, 540
xs += (r * np.cos(t))
ys += (r * np.sin(t))
Ys.insert(0, ys)
if len(Ys) > width:
Ys.pop()
for i in range(len(Ys)):
pg.draw.circle(screen, (255,0,0),(i, Ys), 1, 1)
t += 0.01
pg.display.update()
for e in pg.event.get():
if e.type == pg.QUIT:
sy.exit()
main_menu()
< /code>
Ich dachte, dass der Text vor der Sinuswelle und Sinus nur der Hintergrund sein würde, aber nur der Text wird angezeigt. Ich habe versucht, den Codeblock neu zu arrangieren, aber das hat nicht funktioniert. Ich bin ahnungslos und es ist mein erstes Mal, dass ich ein Projekt in Pygame -Mitguides mache.
Ich kann Sinuswellen nicht sichtbar machen [doppelt] ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post