Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #super player/AI class
- class Player_AI
- def whoissuper
- puts "I am a superclass"
- end
- end
- #race subclasses
- class Elf < Player_AI
- attr_accessor :name, :age
- def initialize(name, age)
- @nickname = name
- @age = age
- end
- def whois
- puts "I am an Elf."
- end
- end
- def what_race
- loop do
- puts "What race would you like to pick? "
- race_pick = gets.chomp
- if race_pick == "elf"
- puts "What is your name? "
- play_name = gets.chomp
- puts "How old are you? "
- play_age = gets.chomp
- player1 = Elf.new(player_name, play_age)
- return player1
- elsif
- race_pick == "dwarf"
- else
- race_pick == "stop"
- break
- end
- end
- end
- what_race
- puts player1.inspect
Advertisement
Add Comment
Please, Sign In to add comment