about summary refs log tree commit diff
path: root/src/simulation.py
diff options
context:
space:
mode:
authorBaitinq <you@example.com>2022-02-11 21:23:06 +0000
committerBaitinq <you@example.com>2022-02-11 21:39:49 +0000
commitf4ac6cf687e5f66305de1b201f3948650ece35fb (patch)
tree71fbeec8431ee24768c1f63a8c273d5d0161c559 /src/simulation.py
parentImplemented proper attitude calculation (instead of just y value) (diff)
downloadOSLS-f4ac6cf687e5f66305de1b201f3948650ece35fb.tar.gz
OSLS-f4ac6cf687e5f66305de1b201f3948650ece35fb.tar.bz2
OSLS-f4ac6cf687e5f66305de1b201f3948650ece35fb.zip
Added first basic sprites
Diffstat (limited to 'src/simulation.py')
-rw-r--r--src/simulation.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/simulation.py b/src/simulation.py
index ffcdaeb..9f6c389 100644
--- a/src/simulation.py
+++ b/src/simulation.py
@@ -91,17 +91,6 @@ class Simulation():
         
         self.speed_x = self.speed_x + (self.acceleration_x * delta)
         self.speed_y = self.speed_y + (self.acceleration_y * delta)
-
-        print("Speed x: " + str(self.speed_x))
-        print("Speed y: " + str(self.speed_y))
-
-        #TODO: WELL CALCULATED? (angle well?)
-        ref_vec = (0, 1)
-        acc_vec = (self.speed_x, self.speed_y)
-        dot = (acc_vec[0] * ref_vec[0]) + (acc_vec[1] * ref_vec[1])
-        det = (acc_vec[0] * ref_vec[1]) - (acc_vec[1] * ref_vec[0])
-        self.heading = math.degrees(math.atan2(det, dot))
-        print("Heading: " + str(self.heading))
         
         #update position based on velocity and delta
         self.x += self.speed_x * delta
@@ -112,10 +101,20 @@ class Simulation():
             self.y -= self.speed_y * delta
             self.speed_x = 0
             self.speed_y = 0
+
+        print("Speed x: " + str(self.speed_x))
+        print("Speed y: " + str(self.speed_y))
             
         print("X: " + str(self.x))
         print("Y: " + str(self.y))
 
+        ref_vec = (0, 1)
+        acc_vec = (self.speed_x, self.speed_y)
+        dot = (acc_vec[0] * ref_vec[0]) + (acc_vec[1] * ref_vec[1])
+        det = (acc_vec[0] * ref_vec[1]) - (acc_vec[1] * ref_vec[0])
+        self.heading = math.degrees(math.atan2(det, dot))
+        print("Heading: " + str(self.heading))
+
         print("Total Simulation Time: " + str(self.time))
         print("")