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
|
@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!")
|
@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
|
# Load from file or initialize a new game
|
||||||
begin
|
begin
|
||||||
@@ -168,15 +168,15 @@ class NumFactory < Gosu::Window
|
|||||||
### CAMERA ###
|
### CAMERA ###
|
||||||
# Move the camera if needed
|
# Move the camera if needed
|
||||||
if self.mouse_x < CAMERA_MOVE_RANGE
|
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
|
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
|
end
|
||||||
|
|
||||||
if self.mouse_y < CAMERA_MOVE_RANGE
|
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
|
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
|
end
|
||||||
|
|
||||||
# Prevent camera from leaving the screen
|
# Prevent camera from leaving the screen
|
||||||
@@ -187,7 +187,7 @@ class NumFactory < Gosu::Window
|
|||||||
|
|
||||||
### ITEMS ###
|
### ITEMS ###
|
||||||
@producers.each do |producer|
|
@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
|
end
|
||||||
|
|
||||||
@belts.each do |belt|
|
@belts.each do |belt|
|
||||||
@@ -198,7 +198,7 @@ class NumFactory < Gosu::Window
|
|||||||
consumer.update(delta_mult, @camera_x, @camera_y, @camera_zoom)
|
consumer.update(delta_mult, @camera_x, @camera_y, @camera_zoom)
|
||||||
end
|
end
|
||||||
@dialouges.each do |dialouge|
|
@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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user