Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
>hey guys,

i am making a game and you have to be able to 'group'. you guys might be thinking that grouping is really easy, but for me, it isn't so easy. this game won't save data by the way, it is just a little application. so, when you do something (lets say attacking) it groups all of your things together. lets say, you see how good you are at attacking, it will have to group your agility, strength, defence, etc. the string will be something like this

VB
dim strength as int = 6
dim agility as int = 3
dim defence as int  5


but we need to group these into one, like a list. could you be able to group these into one list called 'attributes'? please help!!
Posted
Comments
Savalia Manoj M 29-May-12 7:12am    
I can not understand your question. Please explain it detail with example.
Rajesh Kariyavula 29-May-12 8:04am    
Do you mean grouping from your example : 635 or 6 + 3 + 5

You can create a class or structure to hold these values, i have listed a basic structure below.

VB
Public Structure Attributes
       Private _attack As Integer
       Private _def As Integer

       Public Property Attack() As Integer
           Get
               Return _attack
           End Get
           Set(ByVal value As Integer)
               _attack = value
           End Set
       End Property

       Public Property Defence() As Integer
           Get
               Return _def
           End Get
           Set(ByVal value As Integer)
               _def = value
           End Set
       End Property

       Public Sub New(ByVal att As Integer, ByVal def As Integer)
           _attack = att
           _def = def
       End Sub

   End Structure
 
Share this answer
 
Try to use List(Of T) class[^]
VB
Dim myNumbers As New List(Of Integer)
myNumbers.Add(6)
myNumbers.Add(4)
myNumbers.Add(12)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900