Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

What about something like this:

class Sprite
  attr_accessor :x, :y, :width, :height, :color
  def initialize(options = {})
     # set values based on options, assign defaults?
  end
  def to_primitive
    # check to make sure all values make sense, then
    [@x, @y, @width, @height, @color]
  end
end

and have simple classes with  `.to_primitive` calls when you want to render them