From: "Sebastjan H." Date: 2012-10-03T01:57:44+09:00 Subject: Re: still learning by doing - connecting rooms in a game Peter Hickman wrote in post #1076973: > Ok just a few points on the code that you did write. > > Firstly as you have given both name() and state() methods you do not > need the line > > attr_accessor :name, :state I tried this and I removed the attr_accessor line and had the methods defined, but then the code doesn't work: class Zombie def initialize(name, hp, paces, target) @name = name @hp = hp @paces = paces @target = target end def name() @name end def hp() @hp end def paces() @paces end def target() @target end end However, the other way around works: having the attr_accessor line and the initialize method in place w/o specific methods: class Zombie attr_accessor :name, :hp, :paces, :target def initialize(name, hp, paces, target) @name = name @hp = hp @paces = paces @target = target end end What am I doing wrong now? -- Posted via http://www.ruby-forum.com/.