Class: Gosu::Plane
- Inherits:
-
Object
- Object
- Gosu::Plane
- Defined in:
- lib/gosu_android/physics/physicsObject.rb
Overview
Bottom —– Top
Top
|
|
|
Bottom
Instance Attribute Summary collapse
-
#bottom_limit ⇒ Object
Returns the value of attribute bottom_limit.
-
#top_limit ⇒ Object
Returns the value of attribute top_limit.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #draw(x, y, z = @z) ⇒ Object
-
#initialize(window, file_name, p0, p1, z) ⇒ Plane
constructor
A new instance of Plane.
Constructor Details
#initialize(window, file_name, p0, p1, z) ⇒ Plane
Returns a new instance of Plane.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/gosu_android/physics/physicsObject.rb', line 87 def initialize(window, file_name, p0, p1, z) @window = window @image = Gosu::Image.new(@window, file_name) @z = z @top_limit = Array.new p0 @bottom_limit = Array.new p1 if(@bottom_limit[0] > @top_limit[0] or @bottom_limit[1] < @top_limit[1]) @top_limit, @bottom_limit = @bottom_limit, @top_limit end if @bottom_limit[0] == @top_limit[0] @type = :vertical elsif @bottom_limit[1] == @top_limit[1] @type = :horizontal else raise "Planes can only be horizontal or vertical" end end |
Instance Attribute Details
#bottom_limit ⇒ Object
Returns the value of attribute bottom_limit.
85 86 87 |
# File 'lib/gosu_android/physics/physicsObject.rb', line 85 def bottom_limit @bottom_limit end |
#top_limit ⇒ Object
Returns the value of attribute top_limit.
85 86 87 |
# File 'lib/gosu_android/physics/physicsObject.rb', line 85 def top_limit @top_limit end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
86 87 88 |
# File 'lib/gosu_android/physics/physicsObject.rb', line 86 def type @type end |
Instance Method Details
#draw(x, y, z = @z) ⇒ Object
108 109 110 |
# File 'lib/gosu_android/physics/physicsObject.rb', line 108 def draw(x,y,z = @z) @image.draw(x,y,z) end |