When finished, students should have a basic understanding of: 4
Activity 1a – Creating a new script 5
Activity 1b – Creating a game script 7
Session 2 – Creating your first game 16
When finished, students will be able to: 16
When finished, students should have a basic understanding of: 16
Cloning and publishing scripts 16
Random numbers 17
Logical operators in TouchDevelop 19
Arithmetic operators in TouchDevelop 19
Activity 2a – Creating a Fruit Ninja clone 22
Activity 2b – Creating a Pong clone 35
Session 3 – Creating games with multiple sprites of the same type 43
When finished, students will be able to: 43
When finished, students should have a basic understanding of: 43
FOR Loops 44
FOR EACH Loops 44
WHILE Loops 45
Activity 3 – Creating a Breakout clone 45
Session 4 – Creating games using the accelerometer 57
When finished, students will be able to: 57
When finished, students should have a basic understanding of: 57
2D Animation 58
Activity 4a – Creating a basic accelerometer game 61
Activity 4b – Creating a scrolling shooter game 63
Activity 4c – Creating a Space Invaders clone 75
TouchDevelop is an amazing new platform from Microsoft which allows anyone to create applications for mobile devices on mobile devices. When I was a child I taught myself programming in BASIC on an 8-bit computer and the games I created where developed on the same computer that I then played them on. This is a return to that concept as TouchDevelop is a free web/cloud based platform, which runs on any web browser with full HTML5 support. So anyone can create/edit applications on a pc or mobile device and then test that application on the same device. To access TouchDevelop just point your HTML5 web browser to www.touchdevelop.com/app and log in via a Microsoft live, Facebook or Google account.
TouchDevelop can be used to create any type of application, however in this curriculum we will be focusing mainly on creating gaming applications. The purpose of this curriculum will be to introduce basic programming concepts, such as variables, conditions, loops, functions, while students learn to create fun games. The final applications they create can even be published on the Windows Store.
The TouchDevelop interface is designed to be usable with a touch screen tablet or mobile phone, but also with a standard keyboard and mouse on a personal computer or laptop. So in this curriculum I will use the term “select” when I want the student to click on or touch a button in the TouchDevelop interface.
You will find video tutorials for each of the activities in this curriculum on my youtube channel, follow the URL below to my TouchDevelop playlist.
You can also download the latest version of my curriculum from the TouchDevelop website by going to https://www.touchdevelop.com/courses
When finished, students should have a basic understanding of:
Local and global variables
Assigning values to variables
A script in TouchDevelop is basically your application; it contains the code, the art and anything else which makes up the application. The wall is your screen; you can post things to it so that when you run your script you can see them. In game applications you will create a game board, which is posted to the wall and has a specific size and orientation, for the majority of things we will do in this curriculum it will be the board we are working on and we will display it on the wall.
In TouchDevelop functions are called actions and come under the code grouping. Actions are bits of code which perform a specific task, which are usually things that you will want to do in your application more than once. Putting these tasks into actions, means we can call that action whenever we want to do that task, rather than having to repeat the code again and again.
We are going to be encountering variables, in programming a variable is a storage location which holds some information or a value. We give it a name so that we can reference it. For instance a popular variable in computer games is often named SCORE, which (as you might guess) stores the score. Game scores are nearly always numbers, so we want a variable which is a number; this is called the “variable type”. When a variable is created, we need to assign it a variable type, which sets the type of data it can hold. Other popular variable types are Strings (for holding text) and Booleans for holding true or false values. A lot of games have a Boolean variable called GAME OVER, which can be true or false. The other variable type we will use a lot in games is SPRITE, which can be defined as a graphical image which can move.
Variables can also be local or global. A local variable means that the variable can only be accessed or referenced from within the action that it has been creating (declared) within. It is preferably whenever possible to use a local variable, however many variables must be global which means that you can access those variables from anywhere in your game or application. Things like score and lives would generally be set as global.
When working with variables we will often assign values to variables and sometimes we need to check the value contained within a variable.
To assign a value to a variable the symbol we use is :=
To check for a specific value contained within a string you use the equals command.
For instance score := 10 assigns the score variable a value of 10.
While score = 10 means is score equal to 10, which results in a TRUE or FALSE value.
When you create your first script, you should notice that an action script is created by default called MAIN. Most programming languages have something like this, which is a main function which executes first when your application runs; this is the case in TouchDevelop.