about summary refs log tree commit diff
path: root/src/gui/body_sprite.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/body_sprite.py')
-rw-r--r--src/gui/body_sprite.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/body_sprite.py b/src/gui/body_sprite.py
new file mode 100644
index 0000000..708da03
--- /dev/null
+++ b/src/gui/body_sprite.py
@@ -0,0 +1,27 @@
+import pygame
+from pygame.locals import *
+
+from simulation import Simulation
+from body import Body
+
+class Sprite_Body(pygame.sprite.Sprite):
+    def __init__(self, simulation: type[Simulation], floor: int):
+        super().__init__()
+        self.simulation = simulation
+        self.body = self.simulation.body
+        self.floor = floor
+
+    def update(self, display_width, display_height):
+        draw_height = self.floor
+        rocket_altitude = self.simulation.rocket_altitude()
+        body_radius = self.body.radius
+        
+        #draw circle, but in fixed point, not screen
+        self.image = pygame.Surface([display_width, draw_height], pygame.SRCALPHA)
+        self.image.fill((0, 155, 155))
+
+        top_of_floor = display_height - draw_height + rocket_altitude
+        #print("Top of floor: " + str(top_of_floor))
+        
+        self.rect = self.image.get_rect()
+        self.rect = [0, top_of_floor]
\ No newline at end of file