SlideShare a Scribd company logo
Game development 101, part 2 –
game dev programming
Chris Noring
@chris_noring
What did you build?
Second lab, gravity
https://github.com/jlooper/bletchley-park-workshop/blob/main/workshop-
makecode-gravity.md
Constructing a game – the phases
- setup,
- Create the world
- Create you + enemies
- General setup
- Listens to input from
- User, are you moving the avatar?
- Enemy movement, moves towards you or
other patterns,
- World events, is there a timer we need to care
about, other things?
- State changes, Check for state changes
- You died
- You won
- Something happened, you:
- Picked up a coin
- Picked up extra life
- Went into building, sewer pipe (mario)
- Enemy died, adjust no of enemies
Programming
Get the machine to do what you want
Programming a
set of
instructions
verbs –
something you
do
nouns, data
Crack eggs Add sugar
Whisk eggs
and sugar
Add flour
Whisk flour
eggs and sugar
Set owen to
200 C
Bake 20 min
Turn nouns and verbs to variables to
programming
// data, nouns
let eggs = 3;
let bowl = new Bowl();
let sugar = 200; // ml
let owen = new Owen();
let cakepan = new CakePan();
• Crack eggs
• Add sugar
• Whisk eggs and sugar
• Add flour
• Whisk flour eggs and
sugar
• Set owen to 200 C
• Bake 20 min
// functions , what you do, verbs
addIngredient(sugar, bowl);
addIngredient(eggs, bowl);
whisk(bowl);
addIngredient(flour, bowl);
whisk(bowl);
cakepan.fill(bowl);
owen.setTemperature(200);
owen.bake(cakePan);
Variables and functions
let firstNumber = 3;
let secondNumber = 5;
let sum = firstNumber + secondNumber;
function calc(first, second) {
return first + second;
}
let sum = calc(firstNumber, secondNumber);
Variable name Variable value
Function body, what it does
Function keyword
Function name Parameters
Draw on the web
• JavaScript, the programming language
• Canvas, we can paint things on it like:
• Images
• Primitives like rectangles
• Let’s paint someting:
index.html
app.js
<html>
<head>
<body>
<canvas id="myCanvas" width="200"
height="100">
</canvas>
<script src=”app.js”></script>
</body>
</head>
</html>
// draws a red rectangle
//1. get the canvas reference
canvas = document.getElementById("myCanvas")
//2. set the context to 2D to draw basic sha
ctx = canvas.getContext("2d");
//3. fill it with the color red
ctx.fillStyle = 'red’;
//4. and draw a rectangle with these paramet
setting location and size
ctx.fillRect(0,0, 200, 200) // x,y,width, he
Space game, set up
• Load asset (your ship)
• Let’s paint an image, your ship
• Let’s paint a background
function loadAsset(path) {
return new Promise((resolve) => {
const img = new Image();
img.src = path;
img.onload = () => {
// image loaded and ready to be used
resolve(img);
}
})
}
async function run() {
const heroImg = await loadAsset('hero.png’)
canvas = document.getElementById("myCanvas");
ctx = canvas.getContext("2d");
ctx.drawImage(heroImg,
canvas.width/2,canvas.height/2);
}
run();
Next time, space game, movement
Summary
Programming is like cooking, a set of instructions
A game has phases
• Setup
• Running
• Listen for user input
• Enemy movement
• World events
State changes, takes the game forward
• You or enemy dies
• Picks up coin, you level, level is changed etc.

More Related Content

What's hot (20)

PPTX
Ricky Bobby's World
Brian Lonsdorf
 
PDF
The Ring programming language version 1.2 book - Part 37 of 84
Mahmoud Samir Fayed
 
PDF
History of jQuery
jeresig
 
PDF
Nosql hands on handout 04
Krishna Sankar
 
PDF
You will learn RxJS in 2017
名辰 洪
 
PDF
Rethink Async With RXJS
Ryan Anklam
 
PPTX
Azure sql insert perf
Mornè Blake
 
PDF
Strategies for refactoring and migrating a big old project to be multilingual...
benjaoming
 
PDF
The Ring programming language version 1.7 book - Part 54 of 196
Mahmoud Samir Fayed
 
PDF
Deploy in the Cloud
Pablo Cantero
 
PDF
Is HTML5 Ready? (workshop)
Remy Sharp
 
PPTX
Jquery optimization-tips
anubavam-techkt
 
PDF
Esoteric, Obfuscated, Artistic Programming in Ruby
mametter
 
PPTX
Asynchronous programming from Xamarin Hakcday in Melbourne
Filip Ekberg
 
PPT
HTML5 Canvas
Robyn Overstreet
 
PDF
Shibuya.js Lightning Talks
jeresig
 
PPTX
Unity3 d devfest-2014
Vincenzo Favara
 
PPTX
No More Deadlocks; Asynchronous Programming in .NET
Filip Ekberg
 
PPTX
How to make a video game
dandylion13
 
KEY
Leaving Flatland: getting started with WebGL
gerbille
 
Ricky Bobby's World
Brian Lonsdorf
 
The Ring programming language version 1.2 book - Part 37 of 84
Mahmoud Samir Fayed
 
History of jQuery
jeresig
 
Nosql hands on handout 04
Krishna Sankar
 
You will learn RxJS in 2017
名辰 洪
 
Rethink Async With RXJS
Ryan Anklam
 
Azure sql insert perf
Mornè Blake
 
Strategies for refactoring and migrating a big old project to be multilingual...
benjaoming
 
The Ring programming language version 1.7 book - Part 54 of 196
Mahmoud Samir Fayed
 
Deploy in the Cloud
Pablo Cantero
 
Is HTML5 Ready? (workshop)
Remy Sharp
 
Jquery optimization-tips
anubavam-techkt
 
Esoteric, Obfuscated, Artistic Programming in Ruby
mametter
 
Asynchronous programming from Xamarin Hakcday in Melbourne
Filip Ekberg
 
HTML5 Canvas
Robyn Overstreet
 
Shibuya.js Lightning Talks
jeresig
 
Unity3 d devfest-2014
Vincenzo Favara
 
No More Deadlocks; Asynchronous Programming in .NET
Filip Ekberg
 
How to make a video game
dandylion13
 
Leaving Flatland: getting started with WebGL
gerbille
 

Similar to Game dev 101 part 2 (20)

PPT
Gdc09 Minigames
Susan Gold
 
PPTX
Html5 Overview
Abdel Moneim Emad
 
PDF
HTML5: where flash isn't needed anymore
Remy Sharp
 
PPT
Ember.js Tokyo event 2014/09/22 (English)
Yuki Shimada
 
KEY
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
PDF
Is html5-ready-workshop-110727181512-phpapp02
PL dream
 
PPTX
Javascript 1
pavishkumarsingh
 
PDF
SproutCore and the Future of Web Apps
Mike Subelsky
 
PDF
C++ game development with oxygine
corehard_by
 
PDF
From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014
Verold
 
PDF
Yavorsky
Maksym Stepanchuk
 
PDF
Google: Drive, Documents and Apps Script - How to work efficiently and happily
Alessandra Santi
 
PPTX
Viktor Tsykunov "Microsoft AI platform for every Developer"
Lviv Startup Club
 
PPTX
The Challenge of Bringing FEZ to PlayStation Platforms
Miguel Angel Horna
 
PDF
Future of Development and Deployment using Docker
Tamer Abdul-Radi
 
PPT
Capistrano
Travis Roberts
 
PDF
Google's HTML5 Work: what's next?
Patrick Chanezon
 
PDF
Future of Web Apps: Google Gears
dion
 
PDF
Secrets of JavaScript Libraries
jeresig
 
PDF
Refresh Austin - Intro to Dexy
ananelson
 
Gdc09 Minigames
Susan Gold
 
Html5 Overview
Abdel Moneim Emad
 
HTML5: where flash isn't needed anymore
Remy Sharp
 
Ember.js Tokyo event 2014/09/22 (English)
Yuki Shimada
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
Is html5-ready-workshop-110727181512-phpapp02
PL dream
 
Javascript 1
pavishkumarsingh
 
SproutCore and the Future of Web Apps
Mike Subelsky
 
C++ game development with oxygine
corehard_by
 
From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014
Verold
 
Google: Drive, Documents and Apps Script - How to work efficiently and happily
Alessandra Santi
 
Viktor Tsykunov "Microsoft AI platform for every Developer"
Lviv Startup Club
 
The Challenge of Bringing FEZ to PlayStation Platforms
Miguel Angel Horna
 
Future of Development and Deployment using Docker
Tamer Abdul-Radi
 
Capistrano
Travis Roberts
 
Google's HTML5 Work: what's next?
Patrick Chanezon
 
Future of Web Apps: Google Gears
dion
 
Secrets of JavaScript Libraries
jeresig
 
Refresh Austin - Intro to Dexy
ananelson
 
Ad

More from Christoffer Noring (20)

PPTX
Azure signalR
Christoffer Noring
 
PPTX
Game dev workshop
Christoffer Noring
 
PPTX
Deploying your static web app to the Cloud
Christoffer Noring
 
PPTX
IaaS with ARM templates for Azure
Christoffer Noring
 
PPTX
Learning Svelte
Christoffer Noring
 
PPTX
Ng spain
Christoffer Noring
 
PDF
Angular Schematics
Christoffer Noring
 
PDF
Design thinking
Christoffer Noring
 
PDF
Keynote ijs
Christoffer Noring
 
PDF
Vue fundamentasl with Testing and Vuex
Christoffer Noring
 
PDF
Ngrx slides
Christoffer Noring
 
PDF
Kendoui
Christoffer Noring
 
PPTX
Angular mix chrisnoring
Christoffer Noring
 
PDF
Nativescript angular
Christoffer Noring
 
PDF
Graphql, REST and Apollo
Christoffer Noring
 
PDF
Angular 2 introduction
Christoffer Noring
 
PDF
Rxjs vienna
Christoffer Noring
 
PPTX
Rxjs marble-testing
Christoffer Noring
 
PDF
React lecture
Christoffer Noring
 
PPTX
Rxjs ngvikings
Christoffer Noring
 
Azure signalR
Christoffer Noring
 
Game dev workshop
Christoffer Noring
 
Deploying your static web app to the Cloud
Christoffer Noring
 
IaaS with ARM templates for Azure
Christoffer Noring
 
Learning Svelte
Christoffer Noring
 
Angular Schematics
Christoffer Noring
 
Design thinking
Christoffer Noring
 
Keynote ijs
Christoffer Noring
 
Vue fundamentasl with Testing and Vuex
Christoffer Noring
 
Ngrx slides
Christoffer Noring
 
Angular mix chrisnoring
Christoffer Noring
 
Nativescript angular
Christoffer Noring
 
Graphql, REST and Apollo
Christoffer Noring
 
Angular 2 introduction
Christoffer Noring
 
Rxjs vienna
Christoffer Noring
 
Rxjs marble-testing
Christoffer Noring
 
React lecture
Christoffer Noring
 
Rxjs ngvikings
Christoffer Noring
 
Ad

Recently uploaded (20)

PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PPTX
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPTX
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
Thermal runway and thermal stability.pptx
godow93766
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 

Game dev 101 part 2

  • 1. Game development 101, part 2 – game dev programming Chris Noring @chris_noring
  • 2. What did you build?
  • 4. Constructing a game – the phases - setup, - Create the world - Create you + enemies - General setup - Listens to input from - User, are you moving the avatar? - Enemy movement, moves towards you or other patterns, - World events, is there a timer we need to care about, other things? - State changes, Check for state changes - You died - You won - Something happened, you: - Picked up a coin - Picked up extra life - Went into building, sewer pipe (mario) - Enemy died, adjust no of enemies
  • 5. Programming Get the machine to do what you want
  • 6. Programming a set of instructions verbs – something you do nouns, data Crack eggs Add sugar Whisk eggs and sugar Add flour Whisk flour eggs and sugar Set owen to 200 C Bake 20 min
  • 7. Turn nouns and verbs to variables to programming // data, nouns let eggs = 3; let bowl = new Bowl(); let sugar = 200; // ml let owen = new Owen(); let cakepan = new CakePan(); • Crack eggs • Add sugar • Whisk eggs and sugar • Add flour • Whisk flour eggs and sugar • Set owen to 200 C • Bake 20 min // functions , what you do, verbs addIngredient(sugar, bowl); addIngredient(eggs, bowl); whisk(bowl); addIngredient(flour, bowl); whisk(bowl); cakepan.fill(bowl); owen.setTemperature(200); owen.bake(cakePan);
  • 8. Variables and functions let firstNumber = 3; let secondNumber = 5; let sum = firstNumber + secondNumber; function calc(first, second) { return first + second; } let sum = calc(firstNumber, secondNumber); Variable name Variable value Function body, what it does Function keyword Function name Parameters
  • 9. Draw on the web • JavaScript, the programming language • Canvas, we can paint things on it like: • Images • Primitives like rectangles • Let’s paint someting: index.html app.js <html> <head> <body> <canvas id="myCanvas" width="200" height="100"> </canvas> <script src=”app.js”></script> </body> </head> </html> // draws a red rectangle //1. get the canvas reference canvas = document.getElementById("myCanvas") //2. set the context to 2D to draw basic sha ctx = canvas.getContext("2d"); //3. fill it with the color red ctx.fillStyle = 'red’; //4. and draw a rectangle with these paramet setting location and size ctx.fillRect(0,0, 200, 200) // x,y,width, he
  • 10. Space game, set up • Load asset (your ship) • Let’s paint an image, your ship • Let’s paint a background function loadAsset(path) { return new Promise((resolve) => { const img = new Image(); img.src = path; img.onload = () => { // image loaded and ready to be used resolve(img); } }) } async function run() { const heroImg = await loadAsset('hero.png’) canvas = document.getElementById("myCanvas"); ctx = canvas.getContext("2d"); ctx.drawImage(heroImg, canvas.width/2,canvas.height/2); } run();
  • 11. Next time, space game, movement
  • 12. Summary Programming is like cooking, a set of instructions A game has phases • Setup • Running • Listen for user input • Enemy movement • World events State changes, takes the game forward • You or enemy dies • Picks up coin, you level, level is changed etc.

Editor's Notes

  • #10: DOM tree, what a page is, a list of hierarchical nodes, that we can change Canvas, what we can point on, also a Node A canvas a has a contexr, what we actually interact with when we paint something