[Gambas-user] Object creating properties? ball.speed, ball.solid, etc

Simonart Dominique simonart.dominique at ...11...
Sat Apr 18 13:46:39 CEST 2009


Simonart Dominique a écrit :
> jbskaggs a écrit :
>> I need to know how to either create an object to where I can attach a list of
>> variables or how to give myself the ability to do the following:
>>
>> lets say I want to name my special object: ball.
>>
>> I want to be able to create special properties for that ball I can access
>> with .property (or variable)
>>
>> for example:
>>
>> ball.speed
>> ball.solid
>> ball.item
>> ball.gravity
>> ball.life
>> etc...
>>
>>
>> I don't mean Gambas, I mean just being able to attach variables to an object
>> like I mentioned.
>>
>> I write a lot of games and this is something I need to know how to do or at
>> least get close to it.  I have read all the docs I can find and I am
>> probably overlooking it.
>>
>> JB Skaggs
> 
> Hi JB,
> 
> May be I don't understand the real question?
> You just have to create a class, let say BallModel,
> add properties to it, like speed, solid, etc..
> Then you have to create an instance of that class , let say 
> Ball and initialize its properties. :)
> 
> Hope this is what you ask for
> Dominique Simonart
> 

Hi again,

May be the Ball object is already defined in Gambas?
In this case, you have to create a class which inherits this 
object, and add the new properties on this new class

regards,
Dominique Simonart





More information about the User mailing list