This guide is intended to guide the facilitator through the creation of events and using the initializeEventListeners method / tab of the Scene class to create interactive animations in Alice 3. This includes a basic overview of events, event listeners, and event handlers, provide options for participants to use these events, and debriefing the experience at the end. This presentation is not an exhaustive tutorial on events, but rather a demonstration of some key principles. Hopefully students will then be able to experiment on their own.
Creating interactive animations and games can be very interesting to students, and so this lesson can be used relatively early, but it may be delayed until later, depending on the goals of the course. This lesson can be grouped with other lessons that give a more in depth look at how to create the different types of listeners if more support is needed. This lesson can also be supplemented by pointing students towards specific how to materials for different types of desired behaviors. Some of the concepts and structures needed to create different types of event listeners will require the use of Arrays, Conditionals, and Functions. You may want to cover those lessons in conjunction with or before this lesson but it is not required. This lesson should minimally be offered after a lesson in code creation also available on alice.org.
Learning Objectives Covered in this Lesson
• What are events?
• What are event listeners?
• What are event handlers?
• Understand the relationship between initializeEventListeners, myFirstMethod, and the Scene class
• Understand the four types of event listeners in Alice
The Skills addressed in this lesson are:
This project was developed for use with Alice 3. The following Alice 3 skills will be learned through the lesson and additional resources for them are linked to in the How to Resources section of the associated webpage for this guide and also linked to in the tutorial exercise again linked to on the webpage associated with this guide. Optional educational activities can be incorporated based on their relevance to the required steps for the project.
• Where to add event listeners
• Creating and calling event handlers best practices
Basic Overview of Creating the Following
• Scene activation listeners
• Mouse Click event listener
• Keyboard event listener
• Collision/ Proximity event listeners
Default Event Handlers – More Depth
• Add keyboard move for object
• Add object manipulation with mouse