I created a sin equation that I want to use to translate a point on a polygon, but it isn't doing anything. I used print statements for both my equation and coordinate to find out if anything is happening, and they both are fully functional. But the animation is just not playing.
Here's my entire code:
Here's my entire code:
import pygame import random import math BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) BLUE = (0, 0, 255) # cube drawing variables # --- red plane rPlane_p13_x = 640 rPlane_p2_x = 550 rPlane_p4_x = 730 rPlane_p1_y = 230 rPlane_p24_y = 255 rPlane_p3_y = 290 # --- green plane gPlane_p1_x = 550 gPlane_p2_x = 550 gPlane_p34_x = 640 gPlane_p1_y = 255 gPlane_p2_y = 360 gPlane_p3_y = 410 gPlane_p4_y = 290 # --- blue plane bPlane_p12_x = 640 bPlane_p3_x = 730 bPlane_p4_x = 730 bPlane_p1_y = 290 bPlane_p2_y = 410 bPlane_p3_y = 360 bPlane_p4_y = 255 pi = 3.14159265359 pygame.init() size = (1280, 720) screen = pygame.display.set_mode(size) pygame.display.set_caption("Rotating Cube") done = False clock = pygame.time.Clock() while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True screen.fill(WHITE) def draw_cube(): pygame.draw.polygon(screen, RED, [[rPlane_p13_x, rPlane_p1_y], [rPlane_p2_x, rPlane_p24_y], [rPlane_p13_x, rPlane_p3_y], [rPlane_p4_x, rPlane_p24_y]], 0) pygame.draw.polygon(screen, GREEN, [[gPlane_p1_x, gPlane_p1_y], [gPlane_p2_x, gPlane_p2_y], [gPlane_p34_x, gPlane_p3_y], [gPlane_p34_x, gPlane_p4_y]], 0) pygame.draw.polygon(screen, BLUE, [[bPlane_p12_x, bPlane_p1_y], [bPlane_p12_x, bPlane_p2_y], [bPlane_p3_x, bPlane_p3_y], [bPlane_p4_x, bPlane_p4_y]], 0) draw_cube() for degree in range(361): y_value = 50 * math.sin(pi / 180 * degree) gPlane_p2_y += y_value pygame.display.flip() clock.tick(60) pygame.quit()If you've got a solution, please let me know. Thank you.