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

Jussi Lahtinen jussi.lahtinen at ...626...
Sat Apr 18 14:07:06 CEST 2009


'Class CBallModel
Public speed as Integer
Public solid as Integer
Public item as Integer

Then just;
Dim Ball as New CBallModel

'Set speed to 10
Ball.speed = 10

Is that you were looking for?


Jussi





On Sat, Apr 18, 2009 at 14:46, Simonart Dominique
<simonart.dominique at ...11...> wrote:
> 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
>
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list