I'm working on my Modern Physics Final and am doing a python code for my project. I'm doing good for the most part, but I'm trying to create a light clock, which ticks at a specific rate depending on the velocity of the planet or how close it is to a black hole. If you're interested in seeing the whole code, I have it on github:
https://github.com/MaraMaraschino/M-Phys-I/blob/master/Pygame M Phys Final.ipynb
With the light clock, right now I'm just trying to get it to grow AT ALL, but with the code that I have it just draws a bunch of concentric rings at a distance that light would travel each time step. I have:
def light_clock(self, planets, is_1d):
if not self.bh and not self.sun:
if is_1d:
center = scale * self.x + width/2, height/2
else:
center = (scale * self.x + (width/2), scale * self.y + (height/2))
for _ in range(500):
radius = scale * c * dt * (_ + 1)
pygame.draw.circle(win, white, center, radius, 1)
The "is_1d" is there because I'm also trying to draw the system on it's edge as well as from above, so I need it to be able to work for both instances. The circles also stay tethered to the planet's center, but I want it to start drawing at the center and then stay at that location as it expands. I see why it's doing what it's doing, but I have no idea how to get it to do anything else.
Thank you for any help!