if not warrior
return nil
end
in the play_turn method, to workaround a bug. But other than that, this is great!RubyWarrior - Bloc
11–20 of 70 posts
Re: RubyWarrior - Bloc
#12 class Player
attr_reader :warrior
def initialize(warrior)
@warrior = warrior
end
def play_turn
# I can now access `warrior` here or in any other methods I write
end
endRe: RubyWarrior - Bloc
#13Cool idea, but I don't think it makes sense for there to be both a Player class and a warrior object. They seem like they are/should be one in the same. At the very least, I think behind the scenes, the Player class should look more like this such that the warrior object is always available, and I don't need to pass it around from method to method that I define. e.g.: class Player attr_reader :warrior def initialize(…
If there were multiple warriors then your code would no longer make sense, as the control logic would have to be changing the player_instance.warrior object.
Re: RubyWarrior - Bloc
#14Very cool! Proud to see that it's made with ImpactJS[1] (my game engine :)) [1] http://impactjs.com/
Re: RubyWarrior - Bloc
#15Re: RubyWarrior - Bloc
#16Re: RubyWarrior - Bloc
#17Re: RubyWarrior - Bloc
#18Re: RubyWarrior - Bloc
#19Re: RubyWarrior - Bloc
#20This way you could see your own progress, and see what solutions other came up with without bugging them.