From: "Sebastjan H." Date: 2012-08-03T16:14:26+09:00 Subject: Re: learning by doing part 2 - tc game Jan E. wrote in post #1071102: > Hi, > > First of all, don't misuse instance variables to pass values to methods. > This makes the code obscure and fragile -- and it's simply bad design. > Use method parameters instead (that's what they're for). The purpose of > instance variables is to hold the state of an object. > It your case it cannot even work, because you have different objects. > The dragon object cannot access the instance variables from the top > level object. > > So the fix for this would be to simply add a parameter to the "effect" > method for the opponent: > > def effect(opponent) > > And maybe further parameters for other values. Thank you very much for reminding me of the basic rules. kind regards seba -- Posted via http://www.ruby-forum.com/.