class Fanxobj

Attributes

direction[RW]
hilimit[RW]
lolimit[RW]
secondvariable[RW]
variable[RW]

Public Class Methods

new(hsh={}) click to toggle source
# File lib/melody_object/Level_three.rb, line 78
def initialize(hsh={})
@variable=hsh[:var]||=60
@hilimit=hsh[:hi]||=72
@lolimit=hsh[:lo]||=48
@secondvariable=hsh[:secvar]||=5
@direction=hsh[:dir]||=:up
end

Public Instance Methods

fanx() click to toggle source
# File lib/melody_object/Level_three.rb, line 86
def fanx
  if @variable>@hilimit then
  @direction=:down
  @variable-=@secondvariable
  elsif @variable<@lolimit then
  @direction=:up
  @variable+=@secondvariable
  else
    case @direction
    when :up
    @variable+=@secondvariable
    when :down
    @variable-=@secondvariable
    end
  end
  #~ @fyl.puts "#{self} #{@variable}"
  return @variable
end