alice-teacher Dynamic object creation in an Alice world

Susan Rivas susanmrivas at gmail.com
Fri Jul 26 12:58:49 EDT 2013


Wow! Thank you Don Slater.

We appreciate the details.
-Susan

http://srivas-computerlab.com
http://srivas-computerlab.com/spanish/spanish.html

Sent from my iPhone

On Jul 26, 2013, at 8:38 AM, Don Slater <dslater at andrew.cmu.edu> wrote:

> It is not possible to dynamically create objects over and over again in Alice 2... I might suggest creating a set of cars, and when the set is empty, put in some sort of wait condition that allows traffic to clear from the queue...
> 
> The Alice 3 IDE also does not support dynamic allocation at this time, although it may in the future. However, if you import your Alice 3.1 project into NetBeans, it is possible to use Java for dynamic object creation.
> 
> Briefly:
>  
> Instantiate the new object
>       Car c = new Car();
> 
> Set the cars vehicle to the scene
>        c.setVehicle(this);
> 
> You will then need to figure out where to position it and so forth. Perhaps you an object marker, carStartPos in the scene... Then
>        C.moveAndOrientTo(carStartPos);
> 
> I hope this helps...
> 
> All the best,
> Don Slater
> 
> 
> 
> All the best,
> Don Slater
> 
> Sent from my iPad
> 
> On Jul 26, 2013, at 9:26 AM, André Gustavo Schaeffer <andre_schaeffer at yahoo.com.br> wrote:
> 
>> Hi all!
>>  
>> Is it possible to make the creation of dynamic objects in an Alice world?
>> For example, in a simulation, within a loop, I want a car pass every 5 seconds (or variable period of time) through the screen.
>> For each one, if they can’t go ahead due some reason, they will have to wait in a queue (a street intersection with a traffic light, for example). 
>> But I don’t know how long the simulation will take.
>> So, I don’t know how many cars to drag to setup the world.
>> In Java there are methods for dynamic creation and destruction of objects, dialog boxes, etc..
>> Is it possible to do this in Alice (version 2 or 3) ?
>> Thank you!
>> 
>> Andre Gustavo Schaeffer
>> andre_schaeffer at yahoo.com.br
>> https://sites.google.com/site/andregustavoschaeffer
>> _______________________________________________
>> alice-teachers mailing list
>> alice-teachers at lists.andrew.cmu.edu
>> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130726/252049cf/attachment.html 


More information about the alice-teachers mailing list