Fixed scrolling speed issue
This commit is contained in:
@@ -44,7 +44,7 @@ class NumFactory < Gosu::Window
|
||||
@camera_y_zoom_offset = HEIGHT.to_f / (@camera_boxes * BOX_SIZE * 2).to_f
|
||||
|
||||
@dd = DialougeBox.new(0, 0, WIDTH, HEIGHT, "This is a really really really really really really really really really really string\nof test text!")
|
||||
@dialouges = [@dd]
|
||||
@dialouges = []
|
||||
|
||||
# Load from file or initialize a new game
|
||||
begin
|
||||
@@ -168,15 +168,15 @@ class NumFactory < Gosu::Window
|
||||
### CAMERA ###
|
||||
# Move the camera if needed
|
||||
if self.mouse_x < CAMERA_MOVE_RANGE
|
||||
@camera_x -= ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - self.mouse_x ) / 5)).to_i, CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
@camera_x -= ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - self.mouse_x ) / 5)), CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
elsif self.mouse_x > WIDTH - CAMERA_MOVE_RANGE
|
||||
@camera_x += ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - (WIDTH - self.mouse_x) ) / 2)).to_i, CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
@camera_x += ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - (WIDTH - self.mouse_x + 1)) / 5)), CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
end
|
||||
|
||||
if self.mouse_y < CAMERA_MOVE_RANGE
|
||||
@camera_y -= ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - self.mouse_y ) / 2)).to_i, CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
@camera_y -= ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - self.mouse_y ) / 5)), CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
elsif self.mouse_y > HEIGHT - CAMERA_MOVE_RANGE
|
||||
@camera_y += ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - (HEIGHT - (self.mouse_y + 1)) ) / 2)).to_i, CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
@camera_y += ([(CAMERA_MOVE_SPEED * ((CAMERA_MOVE_RANGE - (HEIGHT - (self.mouse_y + 1)) ) / 5)), CAMERA_MOVE_MAX_SPEED].min * delta_mult)
|
||||
end
|
||||
|
||||
# Prevent camera from leaving the screen
|
||||
@@ -187,7 +187,7 @@ class NumFactory < Gosu::Window
|
||||
|
||||
### ITEMS ###
|
||||
@producers.each do |producer|
|
||||
producer.update(delta_mult, @camera_x, @camera_y, @camera_zoom)
|
||||
producer.update(delta_mult, @camera_x, @camera_y, @camera_zoom, self.mouse_x, self.mouse_y)
|
||||
end
|
||||
|
||||
@belts.each do |belt|
|
||||
@@ -198,7 +198,7 @@ class NumFactory < Gosu::Window
|
||||
consumer.update(delta_mult, @camera_x, @camera_y, @camera_zoom)
|
||||
end
|
||||
@dialouges.each do |dialouge|
|
||||
dialouge.update(newtext: "My new text is: #{delta_mult}")
|
||||
dialouge.update(0, 0, newtext: "My new text is: #{delta_mult}")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user