160 likes | 254 Views
Microsoft Workshop Day Luke Hennerley Twitter: @GetOnUK. Timetable. Introductions. Luke Hennerley Former NCTC student Microsoft Apprentice for Delta Financial Systems Nominee for Microsoft Apprentice of the year Microsoft Apprentice ambassador
E N D
Microsoft Workshop Day Luke Hennerley Twitter: @GetOnUK
Introductions • Luke Hennerley • Former NCTC student • Microsoft Apprentice for Delta Financial Systems • Nominee for Microsoft Apprentice of the year • Microsoft Apprentice ambassador • Full time software developer at Delta Financial Systems • Dominic Gill • Microsoft Apprentice Lead • Business consultant to Microsoft UK • Michael Power • CEO of Delta Financial Systems – Microsoft Apprentice Employer of the Year 2012 • Employer of 5 apprentices in the last 3 years • Paul Foster • Principal Technical Evangelist – Microsoft UK
Ground rules Our Rules are very simple… BE POSITIVE CONTRIBUTE LISTEN LEARN GET INSPIRED There is no such thing as a “bad” question!
A new technology world Part 2
Some statistics… • 91% of all people on earth have a mobile • Just over half of those are smartphones • 80% of time on a mobile is spent inside apps, 32% on games, 18% web browser, 18% Facebook • 102 billion app store downloads (global revenue of $26 billion) • Over billion tweets are sent every hour • Half a billion active websites (March 2012) • Every month, the online population spends the equivalent of 4 million years online • What does all of this mean? • #opportunity
TouchDevelop - Introduction What is it? TouchDevelop is a new Microsoft program that is based in the cloud to develop applications for PC/Mobile devices. How do I use it? It’s simple, go to the website and sign in with one of the specified accounts. But development is really hard? “I thought programming would have been really hard, but this wasn’t” – Darren, 14 year old student
Session 1 – Creating your first application • Script • A script is a list of commands that can be executed without user interaction. • Sprite • A sprite is essentially an image which can move. A sprite usually has a set of rules that define how it moves and behaves if it were to bump into another sprite. • Variable • A variable is a storage location for holding information or a value. Each variable has a name, the name needs to be understandable so when you come back to your code, you know what the variable is. For example, a popular “variable” for a game would be SCORE. • Types • Each variable will have a type to determine what exactly we are storing, the most popular are STRING, INT and BOOLEAN. • String represents a set of characters, an example would be a string variable called “username” which is assigned the current users name. • Int is a number value, so you could have a variable “level” which has the level number. • Boolean is true/false, an example variable would be “GameOver” • Learning Outcomes • You 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 • You will have a basic understanding of: • Local variables and Global variables • Variable types • Assigning values • Game physics
Task 1 – Creating a script and setting background • Go to https://www.touchdevelop.com/app/ • Main is the entry point to our application, from there we can: • Declare variables • Set backgrounds • Call other aspects of our application • Default variable is “wall” this can be considered as our GUI (graphical user interface), where we display inputs, outputs and in our case today sprites
Task 2– Setting up game loop and the “board” • We have added a board to our GUI for our game. This will be the container for our game. • The board is a variable, it will have all of the sprites inside of it by using co-ordinates to place them as well as having our game physics applied to it • Now we have our board, just like any game there needs to be a way of updating what’s going on inside the board – so we have also defined a game loop. • The loop runs continuously and fires an event every second – when the event happens we update the board/game 0,0 800,0 This is the resolution of our board, this is used for physics and defining positions of items 0,480 800, 480
Task 3– Creating Our First Sprite • We have now added a sprite onto our board, this sprite is static. • The position of the sprite by default is in the middle of the screen (400,240) • This sprite now acts to the physics that are applied of our board, at the moment we haven’t defined any so when we run the game our sprite is quite boring and stays still 0,0 800,0 0,480 800, 480
Task 4– Setting Gravity • We set the gravity of our board to 0, 200 – this means that the ball will fall downwards. • The higher the number, the higher the effect of the gravity in that direction • If we wanted to invert gravity – similar to space, how would we do it? • Set the value to 0, -200 • We also set the boundary of the board – this stops the sprites from coming out of the screen • After that, we set some friction for the objects inside the board so that they respond when the collide with anything 0,0 800,0 0,480 800, 480
Task 5 – Creating Projectile • We set the start position of our sprite to the bottom left (0, 480) • We then set the speed of the ball to be 400, -200 which sets the speed at pixels/second, we have the effect where we move diagonally upwards but the gravity pulls us back down • The boundary and friction allows us to have the effect of an angry bird 0,0 800,0 0,480 800, 480
Task 7 – Final challenge • Our angry bird is a little bit static. It doesn’t rotate in the air in accordance to it’s speed or gravity so the physics are a bit off. We need add a new line into our gameloop so that we set the movement of our angry bird when the event fires. • What coding term is “sprite” at the moment? • Private Variable • To access “sprite” in gameloop, what does “sprite” have to become? • Global Variable • Once you have answered and completed #2, add a line in gameloop for “set angular speed”, setting the value in brackets to “speed x”
Recap • What concepts you learnt about? • Variables and their types • Sprites • Game Physics • Script • Before you started the day, how difficult did you think it would be to create your own angry bird simulation? • What is your opinion on programming now? • Has this interested you? • Why stop now? • If you are interested in taking this to the next stage, creating games such as “pong” or “space invaders”. Even going as far as creating your own game, come and pick up a curriculum for you to follow through.