This video shows how to learn coding (aka computer programming) in Imaginality Create. This includes creating an example scene of a Magnifying Glass that enlarges the Earth, and using the use “View Code” button to view the code that is automatically generated to make this happen. It then uses “Manually Edit Code” to manually edit the code and make it do even more interesting stuff, including “Debug Output” – printing out the value of variables as they are calculated.
You can also download the modules created in this video to try it for yourself and modify it:
The Earth and Magnifier with a point-and-click interaction added.
The Earth and Magnifier with manually coded interaction added.
Using this Example to Teach Coding to Young Children
The example in this video can be used to explain what coding is and give some brief examples of how it can be done. This can be made applicable for any age group – even first graders. Below are some ideas of how you can introduce concepts of coding while providing real-world examples with Imaginality Create. Essentially, I would suggest you should start with concepts of logic and instructions, and then expand this to coding.
- Start with an empty scene. Explain that if you don’t tell it to do anything, it won’t do anything.
- Put the Earth on paddle 1. Explain what you are instructing it to do by using terms like instructions, objects/data and variables. Instructions (you are instructing it to put the Earth object on Paddle 1), objects/data (e.g. the Earth is is a virtual object, but is essentially made of data – data that describes the sphere (possibly go as far as verticies, edges and faces), data that describes the colours (called a texture), and data the describes how it will be placed (its position and rotation). In programming, this collection of data is also called an object), and variables (e.g. Paddle number 1).
- Demonstrate how the Earth object can be changed by altering its data, e.g. by rotating it upsidedown. Then undo this again.
- Explain that someone has already written a lot of code to make all the details of this happen, and that that software can be controlled by giving it new instructions. The simplest type of instructions are by changing variables. The more complex type of instructions are by changing code (which you will cover later).
- Demonstrate how the software can be told to do something different by changing a variable – by changing the “Paddle Number” variable from 1 to 2. Demo it, then change it back.
- Explain that “Earth.mesh” is also a variable that tells it to load the Earth data.
- Ask the class how they think you should go about adding a Magnifying glass (MG) to paddle 2. Then go ahead and do it.
- Demonstrate the Earth and MG. Hilight how they don’t interact with eachother as they have no instructions to do so.
- Ask the class how the Earth and MG could interact. Choose to make the Earth get bigger when it is close to the MG.
- Make an interaction where if Earth gets close to MG, Earth gets 200% larger in one (just one) axis. Explain in terms of logic – there are common logic operators that are used a lot, like IF (e.g. IF Earth is close to MG).
- Demo this interaction. Explain that code is very precise/literal – it will only do exactly what you tell it to, so if you make assumptions, things may not turn how you expected.
- Revisit that instructions can be both changing variables and changing code (technically, code is still just a set of variables, just a larger, more abstract set). View code for the current example. Give an overview of what the code is doing – an initialization set, then an ongoing loop. Point out assignments (make this equal to that); calculations (this multiplied by that); the if statement; other evaluations (Earth.distance(MG) measures the distance from the Earth to the MG).
- Save the module. Suggest this is good so you can experiment freely without risk of loosing your work so far.
- Edit the code manually. Make the Earth scale smoothly/dynamically as a function of the distance of the MG. Maybe do it in steps, make some errors, correct them – good to demonstrate that this happens and can be discovered and fixed.
- Explain that this is coding – writing instructions to make computers and machines do specific tasks. Brainstorm all the different places coding is used: phones, tablets, console games, computers, the operating system itself, web servers, smart TVs, smart watches, even old digital watches, burglar alarms, microwaves, car radios and traffic lights.
Recent Comments