Files
number_factory/producer.rb
T
2026-06-13 12:01:58 -06:00

32 lines
1.1 KiB
Ruby

## Nathan Hinton
## A number producer that will create numbers when an extractor is placed on it.
class Producer
attr_reader :x, :y
# Create producer at a position with the number and rate specified
# @param x [Integer] X position to start at
# @param y [Integer] Y position to start at
# @param number [Integer] The number to produce
# @param rate [Integer] The speed in numbers per second to produce
def initialize(x, y, number, rate)
@x = x
@y = y
@number = number
@rate = (30/rate).to_i
end
# Creates numbers depending on the rate. This is done with knowing that the game is 30 fps so we use that for a counter
def update
end
# Draw the producer. Uses the camera x and y to shift where it should draw
# @param camera_x [Integer] The camera X position
# @param camera_y [Integer] The camera Y position
# @param camera_zoom [Float] The camera zoom
def draw(camera_x, camera_y, camera_zoom)
puts "Drawing at #{@x - camera_x}, #{@y - camera_y}"
Gosu.draw_rect(@x - camera_x, @y - camera_y, camera_zoom * 30, camera_zoom * 30, Gosu::Color::RED, 0)
end
end