pull/1/head
E. Almqvist 3 years ago
parent 94436e47bf
commit cfd4f7bf8c
  1. 4
      app.rb
  2. 6
      physobj.rb

@ -3,7 +3,7 @@ require "gosu"
load "physobj.rb"
class Window < Gosu::Window
attr_accessor :freeze, :caption, :physobjs, :planets, :controller
attr_accessor :freeze, :caption, :physobjs, :planets, :controller, :camera
attr_reader :width, :height, :fonts
def initialize(title, width, height, physobjs = [], planets = [])
@ -24,6 +24,8 @@ class Window < Gosu::Window
@freeze = false
@controller = nil
@camera = Vector[width/2, height/2]
end
def button_up(id)

@ -21,6 +21,8 @@ class PhysObj
end
def tick
@x, @y = @pos[0], @pos[1]
@angle %= 360
if( !world.freeze ) then
if( @accel.magnitude != 0 ) then
@vel += @accel
@ -29,8 +31,6 @@ class PhysObj
if( @vel.magnitude != 0 ) then
@pos += @vel
end
@x, @y = @pos[0], @pos[1]
@angle %= 360
@saved_pos << @pos
while(@saved_pos.length > MAX_PATH_TRACK_POINT) do
@ -162,7 +162,7 @@ class Player < PhysCube
def tick
super
if( @engine ) then
if( @engine && !self.world.freeze ) then
self.vel += self.get_angle_vec * @thrust
end
end

Loading…
Cancel
Save