forked from bionickatana/number_factory
added background
This commit is contained in:
@@ -92,7 +92,16 @@ class NumFactory < Gosu::Window
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end # End file loading
|
end # End file loading
|
||||||
|
|
||||||
|
@background = Gosu.render(@game_width, @game_height) {
|
||||||
|
im = Gosu::Image.new('assets/images/background_square.png', {:tileable => true})
|
||||||
|
(@game_width / 30).to_i.times do |ww|
|
||||||
|
(@game_height / 30).to_i.times do |hh|
|
||||||
|
im.draw(ww * 30, hh * 30)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
@tick_time = Time.now()
|
@tick_time = Time.now()
|
||||||
@delta_time = 0
|
@delta_time = 0
|
||||||
|
|
||||||
@@ -183,6 +192,7 @@ class NumFactory < Gosu::Window
|
|||||||
[self.width, (@camera_max_x - @camera_x) * @camera_zoom].min,
|
[self.width, (@camera_max_x - @camera_x) * @camera_zoom].min,
|
||||||
[self.height, (@camera_max_y - @camera_y) * @camera_zoom].min,
|
[self.height, (@camera_max_y - @camera_y) * @camera_zoom].min,
|
||||||
@background_color, 0)
|
@background_color, 0)
|
||||||
|
@background.draw(0, 0, 0, @camera_zoom, @camera_zoom)
|
||||||
@producers.each do |producer|
|
@producers.each do |producer|
|
||||||
if producer.x <= @camera_max_x && producer.x >= @camera_min_x
|
if producer.x <= @camera_max_x && producer.x >= @camera_min_x
|
||||||
if producer.y <= @camera_max_y && producer.y >= @camera_min_y
|
if producer.y <= @camera_max_y && producer.y >= @camera_min_y
|
||||||
|
|||||||
Reference in New Issue
Block a user