Anonymous
Guest
Hello everyone. What I'm doing right now, is making a platformer script. I've organized my variables into classes. For example,
Now, what I want to do, is access these from the Interpreter. So, I was wondering, how would I do this? I've tried $jump.multiplier_y, but that returns Nil:nilclass, i.e. nil. I noticed that in the ATS, the class is Advanced_Time, but to access it, you use $ats.variable. So how would I assign a Global variable to a class? Thanks for trying to help!
Code:
class Jump
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :multiplier_x # Jump Multiplier (X)
attr_accessor :multiplier_y # Jump Multiplier (Y)
#--------------------------------------------------------------------------
# * X multiplier
#--------------------------------------------------------------------------
def initialize
@multiplier_x = 0
@multiplier_y = 0
end
def multiplier_x
return @multiplier_x.to_i
end
def multiplier_y
return @multiplier_y.to_i
end
end