PDA

View Full Version : "New" keyword in Alice


mcgski
12-09-2011, 09:23 PM
Is there such a thing?

For example, if I want to instantiate a penguin class to I have to explicitly show it in my scene or is there a way to do it programatically throughout the execution of the code?

David B
12-09-2011, 10:14 PM
I am having a hard time understanding what you are asking for.

mcgski
12-11-2011, 10:08 AM
I could not figure out a way to instantiate a class object in code per se. For example, if I want to fill a scene with penguins by instantiating them in code and filling an array with these objects, the only way I can see to do this is by adding the penguin to the scene first, then using the object instance.

pseudo code:

class penguin;

array penguins;

penguins [0] = new penguin;
penguins [1] = new penguin;

legolizard
12-11-2011, 04:17 PM
You must instatiate all objects[within the world] before using them in code.

TauTrumpsPi
12-11-2011, 05:31 PM
Actually, there is no inborn way to do it with Alice, but Arty figured out a way a while ago to breed them in the world, see here: http://alice.org/community/showthread.php?t=6831