lib/minigl/game_object.rb
def draw(map = nil, scale_x = 1, scale_y = 1, alpha = 0xff, color = 0xffffff, angle = nil, flip = nil, z_index = 0, round = false)
      if map.is_a? Hash
        scale_x = map.fetch(:scale_x, 1)
        scale_y = map.fetch(:scale_y, 1)
        alpha = map.fetch(:alpha, 0xff)
        color = map.fetch(:color, 0xffffff)
        angle = map.fetch(:angle, nil)
        flip = map.fetch(:flip, nil)
        z_index = map.fetch(:z_index, 0)
        round = map.fetch(:round, false)
        map = map.fetch(:map, nil)
      end

      color = (alpha << 24) | color
      if angle
        @img[@img_index].draw_rot @x - (map ? map.cam.x : 0) + @img[0].width * scale_x * 0.5,
                                  @y - (map ? map.cam.y : 0) + @img[0].height * scale_y * 0.5,
                                  z_index, angle, 0.5, 0.5, (flip == :horiz ? -scale_x : scale_x),
                                  (flip == :vert ? -scale_y : scale_y), color
      else
        x = @x - (map ? map.cam.x : 0) + (flip == :horiz ? scale_x * @img[0].width : 0)
        y = @y - (map ? map.cam.y : 0) + (flip == :vert ? scale_y * @img[0].height : 0)
        @img[@img_index].draw (round ? x.round : x), (round ? y.round : y),
                              z_index, (flip == :horiz ? -scale_x : scale_x),
                              (flip == :vert ? -scale_y : scale_y), color
      end
    end
def draw(map = nil, scale_x = 1, scale_y = 1, alpha = 0xff, color = 0xffffff, angle = nil, flip = nil, z_index = 0, round = false)
      if map.is_a? Hash
        scale_x = map.fetch(:scale_x, 1)
        scale_y = map.fetch(:scale_y, 1)
        alpha = map.fetch(:alpha, 0xff)
        color = map.fetch(:color, 0xffffff)
        angle = map.fetch(:angle, nil)
        flip = map.fetch(:flip, nil)
        z_index = map.fetch(:z_index, 0)
        round = map.fetch(:round, false)
        map = map.fetch(:map, nil)
      end

      color = (alpha << 24) | color
      if angle
        @img[@img_index].draw_rot @x - (map ? map.cam.x : 0) + @img[0].width * scale_x * 0.5,
                                  @y - (map ? map.cam.y : 0) + @img[0].height * scale_y * 0.5,
                                  z_index, angle, 0.5, 0.5, (flip == :horiz ? -scale_x : scale_x),
                                  (flip == :vert ? -scale_y : scale_y), color
      else
        x = @x - (map ? map.cam.x : 0) + (flip == :horiz ? scale_x * @img[0].width : 0)
        y = @y - (map ? map.cam.y : 0) + (flip == :vert ? scale_y * @img[0].height : 0)
        @img[@img_index].draw (round ? x.round : x), (round ? y.round : y),
                              z_index, (flip == :horiz ? -scale_x : scale_x),
                              (flip == :vert ? -scale_y : scale_y), color
      end
    end
Draws the sprite in the screen

 Parameters:
 [map] A Map object, relative to which the sprite will be drawn (the x
       and y coordinates of the sprite will be changed according to the
       position of the camera).
 [scale_x] A scale factor to be applied horizontally to the image.
 [scale_y] A scale factor to be applied vertically to the image.
 [alpha] The opacity with which the image will be drawn. Valid values
         vary from 0 (fully transparent) to 255 (fully opaque).
 [color] A color filter to apply to the image. A white (0xffffff) filter
         will keep all colors unchanged, while a black (0x000000) filter
         will turn all colors to black. A red (0xff0000) filter will keep
         reddish colors with slight or no change, whereas bluish colors
         will be darkened, for example.
 [angle] A rotation, in degrees, to be applied to the image, relative to
         its center.
 [flip] Specify +:horiz+ to draw the image horizontally flipped or +:vert+
        to draw it vertically flipped.
 [z_index] The z-order to draw the object. Objects with larger z-orders
           will be drawn on top of the ones with smaller z-orders.
 [round] Specify whether the drawing coordinates should be rounded to an
         integer before drawing, to avoid little distortions of the image.
         Only applies when the image is not rotated.

 *Obs.:* This method accepts named parameters.