I thought programming would have been really hard, but this wasn’t

Yüklə 197.55 Kb.
ölçüsü197.55 Kb.
  1   2   3   4   5   6   7   8   9   10

TouchDevelop Curriculum

"I thought programming would have been really hard, but this wasn’t.”

(Darren, 14 year old high school student)

Table of Contents

Foreword 3

Session 1 – Creating your first application 4

When finished, students will be able to: 4

When finished, students should have a basic understanding of: 4

Introduction 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

Conditions 18

Logical operators in TouchDevelop 19

Arithmetic operators in TouchDevelop 19

Actions 19

Collisions 20

Activity 2a – Creating a Fruit Ninja clone 22

Activity 2b – Creating a Pong clone 35

Challenges 42

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

Collections 43

FOR Loops 44

FOR EACH Loops 44

WHILE Loops 45

Activity 3 – Creating a Breakout clone 45

Challenges 56

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

Accelerometer 57

2D Animation 58

Activity 4a – Creating a basic accelerometer game 61

Challenges 62

Activity 4b – Creating a scrolling shooter game 63

Challenges 75

Activity 4c – Creating a Space Invaders clone 75

Challenges 89


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

Session 1 – Creating your first application

When finished, students will be able to:

  • Draw text on the wall

  • Create a script

  • Setup a game board

  • Set background colours and art

  • Create ellipse and rectangular sprites

  • Create sprites from graphic images

  • Set game physics

  • Set the speed and rotation of a sprite

When finished, students should have a basic understanding of:

  • Local and global variables

  • Variable types

  • Assigning values to variables

  • Game physics


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 numeric value contained with a variable the symbol is =

To check for a specific value contained within a string you use the equals command.

repeat t

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.

Dostları ilə paylaş:
  1   2   3   4   5   6   7   8   9   10

Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2017
rəhbərliyinə müraciət

    Ana səhifə