samples/04_physics_and_collisions/09_arbitrary_collision/app/ball.rb
def update args

        if isLeader
          wallBounds args
          @x += @velocity.x
          @y += @velocity.y
          @past.append({x: @x, y: @y, velocity: @velocity})
          #puts @past

          if (@past.length >= BALL_DISTANCE)
            if (@child != nil)
              @child.receiveNext(@past[0])
              @past.shift
            end
          end

        else
          puts "unexpected"
          raise "unexpected"
        end
    end
#Move the ball according to its velocity
Move the ball according to its velocity
Move the ball according to its velocity
def update args
        if isLeader
          wallBounds args
          @x += @velocity.x
          @y += @velocity.y
          @past.append({x: @x, y: @y, velocity: @velocity})
          if (@past.length >= BALL_DISTANCE)
            if (@child != nil)
              @child.receiveNext(@past[0])
              @past.shift
            end
          end
        else
          puts "unexpected"
          raise "unexpected"
        end
    end
def update args if isLeader wallBounds args @x += @velocity . x @y += @velocity . y @past . append ( { x : @x , y : @y , velocity : @velocity } ) if ( @past . length >= BALL_DISTANCE ) if ( @child != nil ) @child . receiveNext ( @past [ 0 ] ) @past . shift end end else puts "unexpected" raise "unexpected" end end
Move the ball according to its velocity
Move the ball according to its velocity
#puts @past
args