class BoxGraphics
Public Class Methods
new(object)
click to toggle source
Calls superclass method
Component::new
# File lib/entities/components/box_graphics.rb, line 2 def initialize(object) super(object) load_sprite end
Public Instance Methods
draw(viewport)
click to toggle source
# File lib/entities/components/box_graphics.rb, line 7 def draw(viewport) @box.draw_rot(x, y, 0, object.angle) Utils.mark_corners(object.box) if $debug end
height()
click to toggle source
# File lib/entities/components/box_graphics.rb, line 12 def height @box.height end
width()
click to toggle source
# File lib/entities/components/box_graphics.rb, line 16 def width @box.width end
Private Instance Methods
boxes()
click to toggle source
# File lib/entities/components/box_graphics.rb, line 35 def boxes @@boxes ||= Gosu::TexturePacker.load_json($window, Utils.media_path('boxes_barrels.json')) end
center_x()
click to toggle source
# File lib/entities/components/box_graphics.rb, line 27 def center_x @center_x ||= x - width / 2 end
center_y()
click to toggle source
# File lib/entities/components/box_graphics.rb, line 31 def center_y @center_y ||= y - height / 2 end
load_sprite()
click to toggle source
# File lib/entities/components/box_graphics.rb, line 22 def load_sprite frame = boxes.frame_list.sample @box = boxes.frame(frame) end