From: Michael Sas Date: 2012-11-29T04:57:14+09:00 Subject: class method defined, still undefinded method exeption Hi i try to untangle tightly coupled classes. To that end theres a class to hold all resources that are needed by multiple other classes. Its called RA for Resource Aggregator. Moving one central object to that class broke the programm. Here's the output: ./video.rb:11:in `initialize': undefined method `screen' for RA:Class (NoMethodError) from ./game.rb:32:in `new' from ./game.rb:32:in `initialize' from ./resourceaggregator.rb:10:in `new' from ./resourceaggregator.rb:10 from ./main.rb:3:in `require' from ./main.rb:3 RA is pretty big, so i ommit most Methods. Its intended to be a utility class and has no custom initialize: class RA @@xRes = 1280 @@yRes = 800 @@colordepth = 16 @@screen = SDL.setVideoMode(@@xRes, @@yRes, @@colordepth, SDL::SRCCOLORKEY) #SDL::FULLSCREEN @@game = Game.new @@videoManager = VideoManager.new ... def self.screen @@screen end end Here is initialisite from VideoManager def initialize @screen = RA.screen @xOffset = 0 @yOffset = 0 end -- Posted via http://www.ruby-forum.com/.