Ben Galyean wrote:
> Stuck again. My random monster-fight generator works, but it's so BASIC.
> How can I do this without the if-statements? Is it a bad thing to stick
> class objects into an array?
Yep.

def rand_fight
  Moblist[rand(Moblist.size)].fight
end

> Also, I know Moblist[0].fight works, but why not Moblist[0..2].fight ?
Because array[range] returns an array.

And btw...
> Moblist = [GOBO, DRAGON, SLIME]
Why are you using constants for all this?

You can also initialize your list something like
moblist = []
3.times do
  moblist << Mob.new
end
-- 
Posted via http://www.ruby-forum.com/.