Method: MiniGL::Ramp#initialize
- Defined in:
- lib/minigl/movement.rb
#initialize(x, y, w, h, left) ⇒ Ramp
Creates a new ramp.
Parameters:
- x
-
The x-coordinate of the top left corner of a rectangle that completely (and precisely) encloses the ramp (thought of as a right triangle).
- y
-
The y-coordinate of the top left corner of the rectangle described above.
- w
-
The width of the ramp (which corresponds to the width of the rectangle described above).
- h
-
The height of the ramp (which corresponds to the height of the rectangle described above, and to the difference between the lowest point of the ramp, where it usually meets the floor, and the highest).
- left
-
Whether the height of the ramp increases from left to right. Use
falsefor a ramp that goes down from left to right.
88 89 90 91 92 93 94 95 96 |
# File 'lib/minigl/movement.rb', line 88 def initialize(x, y, w, h, left) @x = x @y = y @w = w @h = h @left = left @ratio = @h.to_f / @w @factor = @w / Math.sqrt(@w**2 + @h**2) end |