Orbit stuff

pull/1/head
E. Almqvist 3 years ago
parent 6f3f78d171
commit 883af17673
  1. 2
      app.rb
  2. 15
      physobj.rb

@ -50,7 +50,7 @@ cube.pos = Vector[800, 450 + 100]
cube.vel = Vector[4, 0]
cube2 = PhysCube.new("Cube2", window, 8, 8)
cube2.pos = Vector[800, 450]
cube2.pos = Vector[800, 450 + 500]
cube2.vel = Vector[5, 0]
planet.orbit([cube, cube2])

@ -29,7 +29,7 @@ class PhysObj
def render_path
@saved_pos.each do |pos|
Gosu.draw_rect(pos[0], pos[1], 1, 1, Gosu::Color.argb(0xaa_ccccff))
Gosu.draw_rect(pos[0], pos[1], 2, 2, Gosu::Color.argb(0xaa_ccccff))
end
end
@ -53,19 +53,6 @@ class PhysCube < PhysObj
def physics
self.tick
# x, y = self.pos[0], self.pos[1]
# x_max = world.width - self.width
# y_max = world.height - self.height
#
# if( x > x_max ) then
# self.pos[0] = x_max
# self.vel[0] = 0
# end
# if( y > y_max ) then
# self.pos[1] = y_max
# self.vel[1] = 0
# end
end
def draw_vector(vec, scale=2, color=0xaf_ffaaaa)

Loading…
Cancel
Save