Running all Existing Classes in one command
Monkey Forums/Monkey Programming/Running all Existing Classes in one command
| ||
As Im new at monkey I have some noob quastions. Is there a way to run all exsisting classes of all types in one command? I mean that the engine will refer to the OnUpdate() Method of every exsisting Class? Im almost sure its not possible but maybe im wrong. |
| ||
to do that you could create an interface Interface updateable method update:Void() End Interface Class bicycle implements updateable end class Then every class you want to update you put on a list of updateables local b:bicycle=new bicycle local l:List<updateable>=new List<updateable> l.AddLast(b) for local u:updateable=eachin l l.update() next |
| ||
Can you insert diffrent sorts of classes to this list and they will all be excuted? |
| ||
Slenkar I know its not the place but .. Are there equiliant commands in blitzmax |
| ||
q1-yes you can insert any class that implements updateable q2- no, in blitzmax you have to use Extends, so you will have to create a class called updateable and then create classes like bicycle and car that Extend updateable -you can also do this in monkey |
| ||
This is genius tnx for now |
| ||
slenkar you really helped my i o you big time. An advice to all. I must say its worth asking questions and risking sounding silly then trying to face stuff on your own |
| ||
An advice to all. I must say its worth asking questions and risking sounding silly then trying to face stuff on your own I would say you should do it the other way around: Try to do it yourself, then if you get stuck or don't know how to continue then ask questions. And there are no silly questions apart from "Can I ask a question?", but make sure you can not find the answer yourself before asking others. |
| ||
youre welcome |
| ||
hi therevills I do try alot on my own before I ask but still... consulting with people is the best thing. but i cannot nag to people so 90% of stuff i face on my own. cheers |
| ||
Questions are always welcome and may be of interest to other people facing the same situation. |