Sha256: 13462c01d6f807cafb0c52e6a1c982a3812e67dbc22db2ea809ae7dcd13fc638
Contents?: true
Size: 640 Bytes
Versions: 15
Compression:
Stored size: 640 Bytes
Contents
# # module Turnable Left = :turn_left Right = :turn_right def self.included base base.extend ClassMethods end # TODO meta # module ClassMethods def turn_speed amount amount = amount.to_f / 2 define_method :turn_speed do amount end end end # # def turn_speed 0.5 # Default turn speed end # Turns the thing left, depending on turn speed. # def turn_left self.rotation -= self.turn_speed / (SUBSTEPS**2) end # Turns the thing right, depending on turn speed. # def turn_right self.rotation += self.turn_speed / (SUBSTEPS**2) end end
Version data entries
15 entries across 15 versions & 1 rubygems