alice-teacher Tips and Techniques: Alice 3 - Using Key Listeners in interactive programs

Don Slater dslater at andrew.cmu.edu
Thu Dec 22 19:10:19 EST 2011


I have placed on our Facebook page, "Alice Intro to Computer Programming", a link to a second Tips and Techniques video.

Alice 3 Beta does not yet have an events editor built into the interface. In the meantime, it is still possible to create interactive programs in Alice 3 using the Java style convention of adding listeners to specific objects. 

This short video demonstrates how you might use key listeners in your animations. We will add a listener to a soccer ball, so that we can move it using eth arrow keys of our keyboard.

You should be able to view the video by clicking on this link: http://www.youtube.com/watch?feature=player_embedded&v=WKMuhjKAee4

or by visiting the "Alice Intro to Computer Programming" page on Facebook. After you have logged into Facebook, do a search on "Alice Intro to Computer Programming".

Please let me know if you have problems viewing the video.

All the best,
Don Slater

On Dec 22, 2011, at 12:51 PM, Lance Allen wrote:

> What is the link to Alice on Facebook? Thank you.
> 
> On Wed, Dec 21, 2011 at 12:00 PM, Don Slater <dslater at andrew.cmu.edu> wrote:
> See answers below...
> On Dec 19, 2011, at 11:53 AM, Melia, James E. wrote:
> 
> > 1. Certain objects import and turn the run screen red (as opposed to the green grass with other objects). Any ideas on what causes this?
> 
> When an Alice model is created in 3D Modeling software such as Maya or 3DStudio Max, the process includes creating a mesh (skin) and a skeleton as an integrated whole, and the subparts that we can manipulate are integral parts of this skeleton. However, there are certain models in the Alice 2 gallery, typically scenes, that were not created in this way, but instead are composites of different pre-existing models that are brought together to form these larger models. In Alice these components are viewed as subparts, and yet they are not part of the skeletal structure of the overall model. Alice 2 is equipped to deal with htese differences, and it does not cause problems.
> 
> However, the process that we used to import Alice 2 models into the Alice 3 infrastructure did not try and differentiate between the composite models and the standard models, and now the Alice 3 VM, on most machines, will sometimes gag trying to render these particular models. Sometimes updating the video drives of your graphics card will alleviate some of these problems, but more often it does not.
> 
> On windows machines, when running Alice 3, the console window is displayed, and you will see output in the console indicating there is "no geometry for this model". Some of these will still sometimes render without problem.
> 
> We are in the process of redoing the Alice 3 gallery in a pretty significant way, and we will be eliminating these models from the collection.
> 
> The models I know for sure that are problematic are the ocean floor, and the pond, but I know that there are others...
> 
> >
> > 2. I would like the helicopter blades to turn when the world starts. Any ideas?
> 
> In Alice 3, there is a control structure called "Do in thread". Drag a "Do in thread" into the beginning of the run method, or the performMySetup method (preferred), and in that thread create a "while (true)" loop that turns the propeller at the desired speed.
> 
> I will talk about threads in more detail in a future Tips and Techniques. But for now, we take for granted the fact that a computer system can do more than one thing at a time, play music, chat, read email, etc. Concurrency is the ability to perform several operations at the same time on a computer. There are different ways that this is implemented on modern computers. We can think of a process as the execution of a program, and a computer is always running multiple processes when we work with a computer (many in the background that we are completely unaware of.) Threads are  particular routines that run at the same time in one program. The DoTogether in Alice is the best example of multiple threads executing different routines at the same time.
> 
> DoInThread launches one particular thread for one particular routine that we want to run independently of whatever else is going on in our animation (a propeller on a helicopter turning, playing background music, etc).
> 
> >
> > 3. Keyboard controls: make the ball go up, down, forward with keyboard….
> 
> The subject of this weeks Tips and Techniques. It should be posted later today on Facebook, and I will post a link on the listserv as well…
> 
> I hope that this helps…
> 
> All the best,
> Don Slater
> 
> 
> >
> >
> > I knew this stuff in 2.2. Need held on how to do the same thing in 3.0.
> > Thank you!
> >
> > Jim Melia
> >
> > _______________________________________________
> > 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
> 
> 
>  
>  
> 
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers



More information about the alice-teachers mailing list