Sobeman459
Member
I have this data class
What i want to be able to do i use
well just the b1 b2 and b3 to call just the idea from the Bakugan Data Class if that possible and if so how would i do it? Basicly and eventully the player will pick 3 different bakugan objects from a menu to use in a battle but i cannot do that tile i know how to call it. Any help is greatly appreciated. Thank you.
-SoBe
Code:
#===================================================================================
# Bakugan Data Structure
#===================================================================================
#==============================================================================
# ** Bakugan Module
#------------------------------------------------------------------------------
# This Module Holds Classes the Bakugan System Uses
#==============================================================================
module Bakugan
#===========================================================================
# ** Player
#===========================================================================
Player = Struct.new(:b1, :b2, :b3, :g1, :g2, :g3, :a1, :a2, :a3)
class Player
attr_accessor :id
alias_method :player_init, :initialize
def initialize(*struct_args)
# Calls our struct initialize method
player_init(*struct_args)
# Set @id to be the size of our $data_bakugan list
@id = $data_players.size
# Put our object automatically into the list
$data_players[@id] = self
end
end
$data_players = [nil]
#===========================================================================
# ** Bakugan
#===========================================================================
Bakugan = Struct.new(:name, :gpower, :attribute)
class Bakugan
attr_accessor :id
alias_method :bakugan_init, :initialize
def initialize(*struct_args)
# Calls our struct initialize method
bakugan_init(*struct_args)
# Set @id to be the size of our $data_bakugan list
@id = $data_bakugans.size
# Put our object automatically into the list
$data_bakugans[@id] = self
end
end
$data_bakugans = [nil]
Bakugan.new('monster', 450, 3)
#===========================================================================
# ** Gate Card
#===========================================================================
Gate_Card = Struct.new(:name, :action, :pyrus, :aquos, :subterra, :haos, :darkus, :ventus)
class Gate_Card
attr_accessor :id
alias_method :gcard_init, :initialize
def initialize(*struct_args)
# Calls our struct initialize method
gcard_init(*struct_args)
# Set @id to be the size of our $data_gcard list
@id = $data_gcards.size
# Put our object automatically into the list
$data_gcards[@id] = self
end
end
$data_gcards = [nil]
Gate_Card.new('gate', 1, 100, 100, 100, 100, 100, 100)
#===========================================================================
# ** Ability Card
#===========================================================================
Ability_Card = Struct.new(:name, :action, :pyrus, :aquos, :subterra, :haos, :darkus, :ventus)
class Ability_Card
attr_accessor :id
alias_method :acard_init, :initialize
def initialize(*struct_args)
# Calls our struct initialize method
acard_init(*struct_args)
# Set @id to be the size of our $data_acard list
@id = $data_acards.size
# Put our object automatically into the list
$data_acards[@id] = self
end
end
$data_acards = [nil]
Ability_Card.new('ability', 1, 100, 100, 100, 100, 100, 100)
end
What i want to be able to do i use
Code:
Player = Struct.new(:b1, :b2, :b3, :g1, :g2, :g3, :a1, :a2, :a3)
-SoBe