Introduction to TouchDevelop

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

Create a Simple Game in Scratch
events reactive programming
Pong! “The oldest commercially available game in history” Resources created from the video tutorials provided by David Phillips on
Introduction to TouchDevelop
A Christmas Scratch game
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Click your mouse for next slide Dreamweaver – Merging, Coloring, Fonts Now it’s time to fill your page with some more interesting stuff The first thing.
Screens naming screens and concepts Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL and.
Introduction to TouchDevelop
LO: Learn how to develop your game further to include interactions with the device.
Game Design Creating a game called PING Phase 3: Steps for building basic game.
Making a Timer in Alice.
Introduction to TouchDevelop
Getting Started with Moodle Getting Started Logging In Entering Your Address Viewing a Course Navigating Your Course’s Homepage Personalizing Your.
Games. learning objectives o writing games! o understanding the built-in 2D game engine o events in games o using art (pictures, sounds)
Game Maker Day 2 Making a Maze Game.
VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT.
Introduction to TouchDevelop
IPad Basics For Students Set Classroom Rules.
Level 1 Tutorial Project How to put a movie player on your Weebly website using an HTML code.
Game Maker Terminology
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
Website for our class. The information is updated at the end of each.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Variables and Random Numbers Computer App Session 4.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
How to create a basic game in Scratch. The Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high x increasesx decreases.
Setting Up an OnCourse Website Debbie Hale. Sign on to
Introduction to TouchDevelop Lesson 3 – Comments & Lists Created by S. Johnson
Screens naming screens and concepts v2.8 Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Boxes. boxes- learning targets o I will be able to display buttons (boxes) o I will be able to organize boxes o I will be able to create an animation.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Sage Franch | Technical Evangelist Susan Ibach | Technical Evangelist.
Martin Norris Computing Teacher/Leader at Moldgreen Community Primary School, Huddersfield
Boxes. SOUNDBOARD Objective: Tap the boxes to play sounds! Demo:
Basic coding… with TouchDevelop!!
Scratch Helicopter Game
More about comments Review Single Line Comments The # sign is for comments. A comment is a line of text that Python won’t try to run as code. Its just.
Create a Halloween Computer Game in Scratch
MOM! Phineas and Ferb are … Aims:
Click through this presentation at your own pace.
Scratch for Interactivity
PYGAME.
Game Maker Intro to Programming Game Maker Pop Quiz (Both Groups)
Uploading Files to the Remote Server Using Win_SCP Portable
Editing Your Faculty Homepage
Let's Race! Typing on the Home Row
Explain what touch develop is to your students:
Introduction to Object-Oriented Programming
Learning Objective LO: We’re learning to understand when it is appropriate to use particular data types.
Explain what touch develop is to your students:
Introduction to TouchDevelop
Explain what touch develop is to your students:
Introduction to TouchDevelop
Explain what touch develop is to your students:
An audio and visual tutorial
Clemson For Android Devices and Wi-Fi Setup
Explain what touch develop is to your students:
Explain what touch develop is to your students:
Game Maker Intro to Programming Game Maker Pop Quiz (Both Groups)
Explain what touch develop is to your students:
Creating a Simple Game in Scratch
So you want to be a Game Designer
under the direction of Professor Susan Rodger
Presentation transcript:

Introduction to TouchDevelop Lives: Lesson 4 – My First Game: Part 2 High Score: 10000 Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game Lives: “Tin Can Game – Part 2” High Score: 10000 Created by S. Johnson - www.touchdevelop.weebly.com

Learning objectives To know how to keep score in TouchDevelop To know how to create a leaderboard. Created by S. Johnson - www.touchdevelop.weebly.com

My first game – Part 2 In this tutorial, we are going to add two new elements to our Tin Can game to make it more challenging. First we will add a score board and link it to an online leaderboard so you can challenge your friends. Finally we will add some lives to make the game more challenging. Created by S. Johnson - www.touchdevelop.weebly.com

Getting started Open the TouchDevelop app by visiting http://touchdevelop.com/ Login to your account. Tap on your Tin Can Game script. Tap on edit. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 NEW HIGH SCORE! “Adding a score board” Created by S. Johnson - www.touchdevelop.weebly.com

Adding a score board Let’s add a score board to make the game more challenging. First we need to create a new variable to store the score. Go to ▷ main() Add a new line. Tap var on the lower right keyboard. Rename the variable score. Set the score to 0. Created by S. Johnson - www.touchdevelop.weebly.com

Adding a score board continued 2... As we will need to regularly update the score, we need to store it in a global variable. Move the cursor to the new variable. Tap on promote to data. Your code should look like this: Next we need to create a text box to display the score on the screen. Add a new line. Tap var. Rename the variable score sprite. Global Variable Created by S. Johnson - www.touchdevelop.weebly.com

Adding a score board continued 3... Tap on data from the lower right keyboard. Tap on board. Now let’s create the text box to display the number of lives on the screen. Tap on create text. By default, TouchDevelop will create a text with 100 pixels width, 20 pixels height and font size of 40. width height font Created by S. Johnson - www.touchdevelop.weebly.com

Adding a score board continued 4... Tap on the double quotes. Tap on edit. Tap on the “abc” button in the lower left keyboard. Type in Score: Hint: Make sure you leave a space at the end of the word “Score: “ Next we need to add the score on the end of the text. For this we will use the concatenation command. (Remember “Hello World” in lesson 1.) Tap on II. Created by S. Johnson - www.touchdevelop.weebly.com

Adding a score board continued 5... Tap on data. Tap on score. Finally, as we will be regularly updating the score, we need to store the score sprite in a global variable. Move the cursor to the new variable. Tap on promote to data. Your code should look like this: Created by S. Johnson - www.touchdevelop.weebly.com

Adding a score board continued 6... Sprites by default are placed in the centre of the game board. The sprite position can be changed using the set pos command. Add a new line. Tap on data. Tap on score sprite. Tap on set pos. Now let’s enter the x and y coordinates for the life sprite. Enter the following values: 100, 400. Created by S. Johnson - www.touchdevelop.weebly.com

Adding a score board continued 7... Run the game to see what happens. Notice that the score sprite falls off the screen with the tin can. In order to stop the score sprite from falling, we need to apply friction to it. Add a new line. Tap data. Tap score sprite. Tap set friction. Set friction to 1. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 NEW HIGH SCORE! “Updating the score board” Created by S. Johnson - www.touchdevelop.weebly.com

Updating the score board Finally, we need to update the score every time the player taps on the tin can. We need to put this new code in the tap sprite: can sprite event. Go to tap sprite: can sprite. Add a new line. Tap on data. Tap score. Tap on := Tap on data and score again. Created by S. Johnson - www.touchdevelop.weebly.com

Updating the score board continued 1... We are going to give the player 10 points for every time they tap on the tin can. Tap + on the lower left keyboard. Type in 10. Your code should look like this: Run the code to see what happens. Notice that the score does not change when we tap on the tin can. We need to display the updated score on the screen. Created by S. Johnson - www.touchdevelop.weebly.com

Updating the scoreboard continued 2... Add a new line after the previous line of code. Tap on data. Tap score sprite. To update the score we will use the set text command. Tap set text. Tap on the double quotes “”. Created by S. Johnson - www.touchdevelop.weebly.com

Updating the score board continued 3... Tap on edit. Tap on the “abc” button in the lower left keyboard. Type in Score: Remember: Make sure you leave a space at the end of the word “Score: “ Next we need to update the score on the end of the text. Tap on II. Tap on data. Tap on score. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 Lives: “Adding lives” Created by S. Johnson - www.touchdevelop.weebly.com

Adding lives Let’s add some lives to make the game a little more challenging. Just like the score, first we need to create a new variable to store our lives. Go to ▷ main() Add a new line. Tap var on the lower right keyboard. Rename the variable life. Set the number of lives to 3. Created by S. Johnson - www.touchdevelop.weebly.com

Adding lives continued 2... Life As we will need to regularly update the number of lives, we need to store it in a global variable. Move the cursor to the new variable and tap on promote to data. Your code should look like this: Next we need to create a text box to display the number of lives on the screen. Add a new line. Tap var. Rename the variable life sprite. Global Variable Created by S. Johnson - www.touchdevelop.weebly.com

Adding lives continued 3... Tap on data from the lower right keyboard. Tap on board. Now let’s create the text box to display the number of lives on the screen. Tap on create text. Your code should look like this: Created by S. Johnson - www.touchdevelop.weebly.com

Adding lives continued 4... Tap on the double quotes. Tap on edit. Tap on the “abc” button in the lower left keyboard. Type in Lives: Hint: Make sure you leave a space at the end of the word “Lives: “ Next we need to add the number of lives on the end of the text. For this we will use the concatenation command again. Tap on II. Created by S. Johnson - www.touchdevelop.weebly.com

Adding lives continued 5... Tap on data. Tap on life. Finally, we need to store the life sprite in a global variable. Move the cursor to the new variable. Tap on promote to data. Your code should look like this: Created by S. Johnson - www.touchdevelop.weebly.com

Adding lives continued 6... Next let’s re-position where the number of lives will be displayed on the screen. Add a new line. Tap on data. Tap on life sprite. Tap on set pos. Now let’s enter the x and y coordinates for the life sprite. Enter the following values: 650, 400. Created by S. Johnson - www.touchdevelop.weebly.com

Adding lives continued 7... Run the game to see what happens. Notice that the life sprite falls off the screen with the tin can. In order to stop the life sprite from falling, we need to apply friction to it. Add a new line. Tap data. Tap life sprite. Tap set friction. Set friction to 1. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 “Updating lives” Created by S. Johnson - www.touchdevelop.weebly.com

Updating lives Finally, we need to update the number of lives left on the screen every time the player loses a life. We need to put this new code in the gameloop. Go to gameloop. We need to add our new line at the end of our if statement which detects if the tin can has fallen off the board. Find the if statement starting with the line: Tap on the last line inside the if statement (above do nothing) and add a new line. Created by S. Johnson - www.touchdevelop.weebly.com

Updating lives continued 1... First we need update the number of lives left. Tap on data. Tap life. Tap on := Tap on data and life again. No we are going to deduct 1 from life. Tap – on the lower left keyboard. Type in 1. Your code should look like this: Created by S. Johnson - www.touchdevelop.weebly.com

Updating lives continued 2... Finally we need to display the updated number of lives on the screen. Add a new line after the previous line of code. Tap on data. Tap life sprite. To update the number of lives displayed we will use the set text command. Tap set text. Tap on the double quotes “”. Created by S. Johnson - www.touchdevelop.weebly.com

Updating lives continued 3... Tap on edit. Tap on the “abc” button in the lower left keyboard. Type in Lives: Remember: Make sure you leave a space at the end of the word “Lives: “ Next we need to update the number of lives on the end of the text. Tap on II. Tap on data. Tap on life. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 OVER “Ending the game” Created by S. Johnson - www.touchdevelop.weebly.com

Ending the game Run the game to see what happens. Notice that the game never ends and that the number of lives will eventually go into negative numbers. Not much of a challenge if the game never ends! We need to end the game when the number of lives reaches 0. To do this, we use the time → stop command. Created by S. Johnson - www.touchdevelop.weebly.com

Ending the game continued 1... Before we can stop the game, we need to create a new if statement to detect when the number of lives reaches 0. We will place this new if statement in the gameloop event. Go to gameloop. Go to the last line of code and add a new line. Notice this time there is no + symbol. In its place is this symbol. Tap Tap if on the lower right keyboard. Tap on condition. Created by S. Johnson - www.touchdevelop.weebly.com

Ending the game continued 2... Tap on data and tap life. Now let’s check to see if the number of lives is 0. Tap on = Type in 0. Tap on do nothing. Tap time. Tap on stop. Run your game to see what happens. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 High Scores Player 1: 1560 Player 2: 950 Player 3: 150 Player 4: 5 “Creating a leaderboard” Created by S. Johnson - www.touchdevelop.weebly.com

Creating a leaderboard Wouldn’t it be fun to challenge your friends and post their scores online. Well, with TouchDevelop, you can do just that using the bazaar command! First we must upload the players score to the leaderboard using the post leaderboard score command. Go to the gameloop event. We need to add the new code inside the if statement which detects if the number of lives reaches 0. Created by S. Johnson - www.touchdevelop.weebly.com

Creating a leaderboard continued 1... Tap on the line containing: time → stop. We need to add the new code above the time → stop command. If we add the new code after the time → stop command, the code will never run and the player’s score will not be posted to the leaderboard. Tap on the + symbol above the time → stop command. The will add a new line above the time → stop command. Created by S. Johnson - www.touchdevelop.weebly.com

Creating a leaderboard continued 1... Tap on bazaar. Remember: If you can’t see the bazaar button, click on the blue arrow button to cycle through all the available options. Tap on post leaderboard score. Next we need to upload the player’s score. Tap on 0 and delete. Tap on data and score. Your code should look like this: Created by S. Johnson - www.touchdevelop.weebly.com

Creating a leaderboard continued 1... Finally, we need to display the leaderboard on the wall. To do this, we use the post leaderboard to wall command. Add a new line of code. Tap on bazaar. Tap on post leaderboard to wall. Run the code to see what happens. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 “Publishing your script” Created by S. Johnson - www.touchdevelop.weebly.com

Publishing your script Before you can challenge your friends and upload each others high scores to the online leaderboard, you must first publish your script. Tap on publish. Created by S. Johnson - www.touchdevelop.weebly.com

Publishing your script continued... Note: As the warning suggests, once you tap on publish, everyone will be able to see your script. If you are happy to publish your script for everyone to see. Tap on publish. Congratulations! You have created your first game. Created by S. Johnson - www.touchdevelop.weebly.com

TouchDevelop My First Game – Part 2 Challenge Created by S. Johnson - www.touchdevelop.weebly.com

Challenge Challenge 1: Add code to re-spawn the tin can when it falls off the sides of the screen. Hint: You will need to use an if statement. Challenge 2: Increase the speed of the tin can every time a player reaches 100 points. Or Add a second tin can when a player reaches 200 points. Collaborate: Share your game with your classmates and see if they can improve your code. Created by S. Johnson - www.touchdevelop.weebly.com