SlideShare a Scribd company logo
YoussifDaif
Education !!
gametutorials
aplusmath
Visualmaththreading
vectorkids
Game age ppt
Simulation
Game age ppt
Game age ppt
real Business
70,000,000
Game age ppt
Game age ppt
Game age ppt
gaming hardware 17,797
gaming software 44,730
online gaming 11,899
Total 74,426
types...
vs
logic
Sports
Strategy
Shooting
Racing
Online  OR  Web
1,000,000,000 $
Online games sales
66 B $
no programming language ..!
Components ...
Let's Play ...
Welcome!
Catch Devmix
What Do First?
• Create HTML File With name index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>catch Devmix </title>
</head>
<body>
<script src="js/game.js"></script>
</body>
<html/>
And Then
• Create game.js file and Put this
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = 512;
canvas.height = 480;
document.body.appendChild(canvas);
//Here We create Canvas With required Deminsion
Put Background and our
characters
• First put Background :-
var bgReady = false;
var bgImage = new Image();
bgImage.onload = function () {
bgReady = true;
};
bgImage.src = "images/background.png";
Put Background and our
characters
• Then Create The Hero :) :-
var heroReady = false;
var heroImage = new Image();
heroImage.onload = function () {
heroReady = true;
};
heroImage.src = "images/hero.png";
Put Background and our
characters
Then Create DX (The queen) :-
var dxReady = false;
var dxImage = new Image();
dxImage.onload = function () {
dxReady = true;
};
dxImage.src = "images/dx.png";
Put Background and our
characters
• Then Create Our Enemy if it was hard or very hard :-
var monsterReady = false;
var monsterImage = new Image();
monsterImage.onload = function () {
monsterReady = true;
};
monsterImage.src = "images/monster.png";
Define Game Objects
var hero = {
speed: 256 // movement in pixels per second
};
var monster = {};
var dx ={}
var dxCaught = 0;
var lvl,mover0,mover1;
Handle keyboard controls
var keysDown = {};
addEventListener("keydown", function (e) {
keysDown[e.keyCode] = true;
}, false);
addEventListener("keyup", function (e) {
delete keysDown[e.keyCode];
}, false);
Draw everything
var render = function () {
if (bgReady) {
ctx.drawImage(bgImage, 0, 0);
}
if (heroReady) {
ctx.drawImage(heroImage, hero.x, hero.y);
}
if (monsterReady) {
ctx.drawImage(monsterImage, monster.x, monster.y);
}
if (dxReady) {
ctx.drawImage(dxImage, dx.x, dx.y);
}
Draw everything
//score
ctx.fillStyle = "rgb(250, 250, 250)";
ctx.font = "24px Helvetica";
ctx.textAlign = "left";
ctx.textBaseline = "top";
ctx.fillText("Goblins caught: " + monstersCaught,
32, 32);
};
Reset the game when the Hero
catches a enemy
var reset = function () {
clearInterval(mover0);
clearInterval(mover1);
hero.x = canvas.width / 2;
hero.y = canvas.height / 2;
// Throw the dx somewhere on the screen randomly
dx.x = 32 + (Math.random() * (canvas.width - 94));
dx.y = 32 + (Math.random() * (canvas.height - 94));
If(lvl > 0)
mover0 = setInterval(??);
Reset the game when the Hero
catches a enemy
// Throw the monster somewhere on the screen randomly
//if it was hard or very hard
If(lvl > 2){
monster.x = 32 + (Math.random() * (canvas.width - 94));
monster.y = 32 + (Math.random() * (canvas.height - 94));
mover1 = setInterval(??);
}
};
Let's play this game!
reset();
var then = Date.now();
setInterval(main, 1); // Execute as fast as
possible
The main game loop
var main = function () {
var now = Date.now();
var delta = now - then;
update(delta / 1000);
render();
then = now;
};
Update game objects
var update = function (modifier) {
if (38 in keysDown) { // Player holding up
hero.y -= hero.speed * modifier;
}
if (40 in keysDown) { // Player holding down
hero.y += hero.speed * modifier;
}
if (37 in keysDown) { // Player holding left
hero.x -= hero.speed * modifier;
}
if (39 in keysDown) { // Player holding right
hero.x += hero.speed * modifier;
}
Update game objects
//Are they touching?
if (
hero.x <= (dx.x + 32)
&& dx.x <= (hero.x + 32)
&& hero.y <= (dx.y + 32)
&& dx.y <= (hero.y + 32)
) {
++dxCaught;
reset();
}
Update game objects
if(lvl > 2 && hero.x <= (monster.x + 32)
&& monster.x <= (hero.x + 32)
&& hero.y <= (monster.y + 32)
&& monster.y <= (hero.y + 32)
) {
reset();
}
};
End & Questions
?
Thanks

More Related Content

PPTX
Game dev 101 part 3
PPTX
Game dev 101 part 2
PPTX
Making Games in JavaScript
KEY
Cocos2dを使ったゲーム作成の事例
PDF
The Ring programming language version 1.5.1 book - Part 48 of 180
PPTX
CreateJS
PDF
The Ring programming language version 1.5.2 book - Part 52 of 181
PDF
The Ring programming language version 1.8 book - Part 56 of 202
Game dev 101 part 3
Game dev 101 part 2
Making Games in JavaScript
Cocos2dを使ったゲーム作成の事例
The Ring programming language version 1.5.1 book - Part 48 of 180
CreateJS
The Ring programming language version 1.5.2 book - Part 52 of 181
The Ring programming language version 1.8 book - Part 56 of 202

What's hot (15)

PDF
The Ring programming language version 1.8 book - Part 59 of 202
PDF
HTML5 Canvas - Let's Draw!
DOCX
Snake report ROHIT MALAV
PDF
Programming a Trojan Horse
PDF
The Ring programming language version 1.5.2 book - Part 49 of 181
PPTX
Aditazz 01-ul
TXT
Variables
PDF
The Ring programming language version 1.7 book - Part 54 of 196
PDF
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
PDF
Node meetup feb_20_12
PDF
The Ring programming language version 1.5.4 book - Part 50 of 185
PDF
iOS Game Development with Cocos2D
PDF
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
PDF
Cocos2dx 7.1-7.2
PDF
Strategies for refactoring and migrating a big old project to be multilingual...
The Ring programming language version 1.8 book - Part 59 of 202
HTML5 Canvas - Let's Draw!
Snake report ROHIT MALAV
Programming a Trojan Horse
The Ring programming language version 1.5.2 book - Part 49 of 181
Aditazz 01-ul
Variables
The Ring programming language version 1.7 book - Part 54 of 196
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
Node meetup feb_20_12
The Ring programming language version 1.5.4 book - Part 50 of 185
iOS Game Development with Cocos2D
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Cocos2dx 7.1-7.2
Strategies for refactoring and migrating a big old project to be multilingual...
Ad

Viewers also liked (20)

PPTX
Safer sex
PPS
Whattodo1
PPT
Comic strips
PPT
New in html5
PPTX
#2 of HTML and CSS3
PDF
PENGENDALIAN HIPERTENSI
PPT
Curriculum vitae
PDF
February 19, 2011
PPT
Metode penelitian 5+6
DOC
Eileen Shanahan Curriculum Vitae
PPT
#1 of HTML and CSS3
PPT
MobileMediaStrategies11DominicJacquesson
PPT
Presentation scoliosis
PPT
Component Diagram
PDF
Service Operation Processes
PDF
Stratégie de contenu numérique - Édition Restauration 2015
PDF
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout
PDF
Les agences media et leurs sites internet
PDF
La refonte d’un intranet : 10 cles pour reussir votre projet
PDF
Etude de marché Beiersdorf/Nivea
Safer sex
Whattodo1
Comic strips
New in html5
#2 of HTML and CSS3
PENGENDALIAN HIPERTENSI
Curriculum vitae
February 19, 2011
Metode penelitian 5+6
Eileen Shanahan Curriculum Vitae
#1 of HTML and CSS3
MobileMediaStrategies11DominicJacquesson
Presentation scoliosis
Component Diagram
Service Operation Processes
Stratégie de contenu numérique - Édition Restauration 2015
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout
Les agences media et leurs sites internet
La refonte d’un intranet : 10 cles pour reussir votre projet
Etude de marché Beiersdorf/Nivea
Ad

Similar to Game age ppt (20)

PDF
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
PDF
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
PPTX
Unity workshop
PDF
PPTX
98 374 Lesson 06-slides
PPTX
Intro to Construct 2: Ghost Shooter - Step by Step
PDF
Html5game presentation
PPTX
Game Programming Syllabus for B.Tech Final Year
PDF
One codebase, multiple platforms; Using HTML5/js for game dev
PDF
Gotta code them all, a Pokémon and HTML5 love story!
PPSX
The contents of making games: If making games was a book
PPT
"Pemrograman Python untuk Pemula dan Ahli"
PPTX
How to make a video game
PPT
Pygame : créer des jeux interactifs en Python.
PPTX
Game Design Document - Step by Step Guide
PPSX
Street runner final
PDF
PDF
Intro to HTML5
PDF
How tomakea gameinunity3d
PPTX
XNA in a Day
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
Unity workshop
98 374 Lesson 06-slides
Intro to Construct 2: Ghost Shooter - Step by Step
Html5game presentation
Game Programming Syllabus for B.Tech Final Year
One codebase, multiple platforms; Using HTML5/js for game dev
Gotta code them all, a Pokémon and HTML5 love story!
The contents of making games: If making games was a book
"Pemrograman Python untuk Pemula dan Ahli"
How to make a video game
Pygame : créer des jeux interactifs en Python.
Game Design Document - Step by Step Guide
Street runner final
Intro to HTML5
How tomakea gameinunity3d
XNA in a Day

Recently uploaded (20)

PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Institutional Correction lecture only . . .
PPTX
Lesson notes of climatology university.
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Pre independence Education in Inndia.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
RMMM.pdf make it easy to upload and study
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Microbial disease of the cardiovascular and lymphatic systems
Institutional Correction lecture only . . .
Lesson notes of climatology university.
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPH.pptx obstetrics and gynecology in nursing
Pre independence Education in Inndia.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
102 student loan defaulters named and shamed – Is someone you know on the list?
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
RMMM.pdf make it easy to upload and study
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
O7-L3 Supply Chain Operations - ICLT Program
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Anesthesia in Laparoscopic Surgery in India
Final Presentation General Medicine 03-08-2024.pptx
VCE English Exam - Section C Student Revision Booklet
Renaissance Architecture: A Journey from Faith to Humanism

Game age ppt

  • 13. gaming hardware 17,797 gaming software 44,730 online gaming 11,899 Total 74,426
  • 15. vs
  • 16. logic
  • 27. What Do First? • Create HTML File With name index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>catch Devmix </title> </head> <body> <script src="js/game.js"></script> </body> <html/>
  • 28. And Then • Create game.js file and Put this var canvas = document.createElement("canvas"); var ctx = canvas.getContext("2d"); canvas.width = 512; canvas.height = 480; document.body.appendChild(canvas); //Here We create Canvas With required Deminsion
  • 29. Put Background and our characters • First put Background :- var bgReady = false; var bgImage = new Image(); bgImage.onload = function () { bgReady = true; }; bgImage.src = "images/background.png";
  • 30. Put Background and our characters • Then Create The Hero :) :- var heroReady = false; var heroImage = new Image(); heroImage.onload = function () { heroReady = true; }; heroImage.src = "images/hero.png";
  • 31. Put Background and our characters Then Create DX (The queen) :- var dxReady = false; var dxImage = new Image(); dxImage.onload = function () { dxReady = true; }; dxImage.src = "images/dx.png";
  • 32. Put Background and our characters • Then Create Our Enemy if it was hard or very hard :- var monsterReady = false; var monsterImage = new Image(); monsterImage.onload = function () { monsterReady = true; }; monsterImage.src = "images/monster.png";
  • 33. Define Game Objects var hero = { speed: 256 // movement in pixels per second }; var monster = {}; var dx ={} var dxCaught = 0; var lvl,mover0,mover1;
  • 34. Handle keyboard controls var keysDown = {}; addEventListener("keydown", function (e) { keysDown[e.keyCode] = true; }, false); addEventListener("keyup", function (e) { delete keysDown[e.keyCode]; }, false);
  • 35. Draw everything var render = function () { if (bgReady) { ctx.drawImage(bgImage, 0, 0); } if (heroReady) { ctx.drawImage(heroImage, hero.x, hero.y); } if (monsterReady) { ctx.drawImage(monsterImage, monster.x, monster.y); } if (dxReady) { ctx.drawImage(dxImage, dx.x, dx.y); }
  • 36. Draw everything //score ctx.fillStyle = "rgb(250, 250, 250)"; ctx.font = "24px Helvetica"; ctx.textAlign = "left"; ctx.textBaseline = "top"; ctx.fillText("Goblins caught: " + monstersCaught, 32, 32); };
  • 37. Reset the game when the Hero catches a enemy var reset = function () { clearInterval(mover0); clearInterval(mover1); hero.x = canvas.width / 2; hero.y = canvas.height / 2; // Throw the dx somewhere on the screen randomly dx.x = 32 + (Math.random() * (canvas.width - 94)); dx.y = 32 + (Math.random() * (canvas.height - 94)); If(lvl > 0) mover0 = setInterval(??);
  • 38. Reset the game when the Hero catches a enemy // Throw the monster somewhere on the screen randomly //if it was hard or very hard If(lvl > 2){ monster.x = 32 + (Math.random() * (canvas.width - 94)); monster.y = 32 + (Math.random() * (canvas.height - 94)); mover1 = setInterval(??); } };
  • 39. Let's play this game! reset(); var then = Date.now(); setInterval(main, 1); // Execute as fast as possible
  • 40. The main game loop var main = function () { var now = Date.now(); var delta = now - then; update(delta / 1000); render(); then = now; };
  • 41. Update game objects var update = function (modifier) { if (38 in keysDown) { // Player holding up hero.y -= hero.speed * modifier; } if (40 in keysDown) { // Player holding down hero.y += hero.speed * modifier; } if (37 in keysDown) { // Player holding left hero.x -= hero.speed * modifier; } if (39 in keysDown) { // Player holding right hero.x += hero.speed * modifier; }
  • 42. Update game objects //Are they touching? if ( hero.x <= (dx.x + 32) && dx.x <= (hero.x + 32) && hero.y <= (dx.y + 32) && dx.y <= (hero.y + 32) ) { ++dxCaught; reset(); }
  • 43. Update game objects if(lvl > 2 && hero.x <= (monster.x + 32) && monster.x <= (hero.x + 32) && hero.y <= (monster.y + 32) && monster.y <= (hero.y + 32) ) { reset(); } };