SlideShare a Scribd company logo
YoussifDaif
Education !!
gametutorials
aplusmath
Visualmaththreading
vectorkids
Simulation
real Business
70,000,000
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

What's hot

The Ring programming language version 1.8 book - Part 59 of 202
The Ring programming language version 1.8 book - Part 59 of 202The Ring programming language version 1.8 book - Part 59 of 202
The Ring programming language version 1.8 book - Part 59 of 202
Mahmoud Samir Fayed
 
HTML5 Canvas - Let's Draw!
HTML5 Canvas - Let's Draw!HTML5 Canvas - Let's Draw!
HTML5 Canvas - Let's Draw!
Phil Reither
 
Snake report ROHIT MALAV
Snake report ROHIT MALAVSnake report ROHIT MALAV
Snake report ROHIT MALAV
Rohit malav
 
Programming a Trojan Horse
Programming a Trojan HorseProgramming a Trojan Horse
Programming a Trojan Horse
Angelina Rudenko
 
The Ring programming language version 1.5.2 book - Part 49 of 181
The Ring programming language version 1.5.2 book - Part 49 of 181The Ring programming language version 1.5.2 book - Part 49 of 181
The Ring programming language version 1.5.2 book - Part 49 of 181
Mahmoud Samir Fayed
 
Aditazz 01-ul
Aditazz 01-ulAditazz 01-ul
Aditazz 01-ul
michaelsbergin
 
Variables
VariablesVariables
Variables
Erik Hermawan
 
The Ring programming language version 1.7 book - Part 54 of 196
The Ring programming language version 1.7 book - Part 54 of 196The Ring programming language version 1.7 book - Part 54 of 196
The Ring programming language version 1.7 book - Part 54 of 196
Mahmoud Samir Fayed
 
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte RangeScaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
Scaling MongoDB; Sharding Into and Beyond the Multi-Terabyte Range
MongoDB
 
Node meetup feb_20_12
Node meetup feb_20_12Node meetup feb_20_12
Node meetup feb_20_12
jafar104
 
The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185
Mahmoud Samir Fayed
 
iOS Game Development with Cocos2D
iOS Game Development with Cocos2DiOS Game Development with Cocos2D
iOS Game Development with Cocos2D
Greenwell
 
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficientTh 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Bin Shao
 
Cocos2dx 7.1-7.2
Cocos2dx 7.1-7.2Cocos2dx 7.1-7.2
Cocos2dx 7.1-7.2
Kyungryul KIM
 
Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...
benjaoming
 

What's hot (15)

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

Viewers also liked

Safer sex
Safer sexSafer sex
Safer sex
Samantha Coetzee
 
Whattodo1
Whattodo1Whattodo1
Whattodo1
Mukul Chaudhri
 
Comic strips
Comic stripsComic strips
Comic strips
Abril Vallejo
 
New in html5
New in html5New in html5
New in html5
Ahmed Yousef
 
#2 of HTML and CSS3
#2 of HTML and CSS3 #2 of HTML and CSS3
#2 of HTML and CSS3
Ahmed Yousef
 
PENGENDALIAN HIPERTENSI
PENGENDALIAN HIPERTENSIPENGENDALIAN HIPERTENSI
PENGENDALIAN HIPERTENSIanugrahwati
 
Curriculum vitae
Curriculum vitaeCurriculum vitae
Curriculum vitae
chuanrui
 
February 19, 2011
February 19, 2011February 19, 2011
February 19, 2011
Kangaroo Kids Education Ltd.
 
Metode penelitian 5+6
Metode penelitian 5+6Metode penelitian 5+6
Metode penelitian 5+6anugrahwati
 
Eileen Shanahan Curriculum Vitae
Eileen Shanahan Curriculum VitaeEileen Shanahan Curriculum Vitae
Eileen Shanahan Curriculum Vitae
Eileen Shanahan
 
#1 of HTML and CSS3
#1 of HTML and CSS3 #1 of HTML and CSS3
#1 of HTML and CSS3
Ahmed Yousef
 
MobileMediaStrategies11DominicJacquesson
MobileMediaStrategies11DominicJacquessonMobileMediaStrategies11DominicJacquesson
MobileMediaStrategies11DominicJacquesson
Briefing Media
 
Presentation scoliosis
Presentation scoliosisPresentation scoliosis
Presentation scoliosis
Beatrice Balaoing
 
Component Diagram
Component DiagramComponent Diagram
Component Diagram
Ahmed Yousef
 
Service Operation Processes
Service Operation ProcessesService Operation Processes
Service Operation Processes
nuwulang
 
Stratégie de contenu numérique - Édition Restauration 2015
Stratégie de contenu numérique - Édition Restauration 2015Stratégie de contenu numérique - Édition Restauration 2015
Stratégie de contenu numérique - Édition Restauration 2015
Gigi Huynh
 
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout
Meetup CocoaHeads Montpellier : conférence sur l'Auto LayoutMeetup CocoaHeads Montpellier : conférence sur l'Auto Layout
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout
Idean France
 
Les agences media et leurs sites internet
Les agences media et leurs sites internetLes agences media et leurs sites internet
Les agences media et leurs sites internetThomas Postclic
 
La refonte d’un intranet : 10 cles pour reussir votre projet
La refonte d’un intranet : 10 cles pour reussir votre projetLa refonte d’un intranet : 10 cles pour reussir votre projet
La refonte d’un intranet : 10 cles pour reussir votre projet
PhilippeC
 
Etude de marché Beiersdorf/Nivea
Etude de marché Beiersdorf/NiveaEtude de marché Beiersdorf/Nivea
Etude de marché Beiersdorf/Nivea
Edouard Kinziger
 

Viewers also liked (20)

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

Similar to Game age ppt

JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
Laurence Svekis ✔
 
Pointer Events in Canvas
Pointer Events in CanvasPointer Events in Canvas
Pointer Events in Canvas
deanhudson
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
Jussi Pohjolainen
 
Real life XNA
Real life XNAReal life XNA
Real life XNA
Johan Lindfors
 
Really Fast HTML5 Game Development with CreateJS
Really Fast HTML5 Game Development with CreateJSReally Fast HTML5 Game Development with CreateJS
Really Fast HTML5 Game Development with CreateJS
Dave Kelleher
 
How to make a video game
How to make a video gameHow to make a video game
How to make a video game
dandylion13
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
goodfriday
 
Intro to Game Programming
Intro to Game ProgrammingIntro to Game Programming
Intro to Game Programming
Richard Jones
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overview
MICTT Palma
 
Stupid Canvas Tricks
Stupid Canvas TricksStupid Canvas Tricks
Stupid Canvas Tricks
deanhudson
 
HTML5 Games with CreateJS
HTML5 Games with CreateJSHTML5 Games with CreateJS
HTML5 Games with CreateJS
Dave Kelleher
 
Intro to programming games with clojure
Intro to programming games with clojureIntro to programming games with clojure
Intro to programming games with clojure
Juio Barros
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
tutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
tutorialsruby
 
WP7 HUB_XNA
WP7 HUB_XNAWP7 HUB_XNA
WP7 HUB_XNA
MICTT Palma
 
MIDP: Game API
MIDP: Game APIMIDP: Game API
MIDP: Game API
Jussi Pohjolainen
 
Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2
Marlon Luz
 
Unity3 d devfest-2014
Unity3 d devfest-2014Unity3 d devfest-2014
Unity3 d devfest-2014
Vincenzo Favara
 
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
Lviv Startup Club
 
Dart - en ny platform til webudvikling af Rico Wind, Google
Dart - en ny platform til webudvikling af Rico Wind, GoogleDart - en ny platform til webudvikling af Rico Wind, Google
Dart - en ny platform til webudvikling af Rico Wind, Google
InfinIT - Innovationsnetværket for it
 

Similar to Game age ppt (20)

JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
 
Pointer Events in Canvas
Pointer Events in CanvasPointer Events in Canvas
Pointer Events in Canvas
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
Real life XNA
Real life XNAReal life XNA
Real life XNA
 
Really Fast HTML5 Game Development with CreateJS
Really Fast HTML5 Game Development with CreateJSReally Fast HTML5 Game Development with CreateJS
Really Fast HTML5 Game Development with CreateJS
 
How to make a video game
How to make a video gameHow to make a video game
How to make a video game
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
 
Intro to Game Programming
Intro to Game ProgrammingIntro to Game Programming
Intro to Game Programming
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overview
 
Stupid Canvas Tricks
Stupid Canvas TricksStupid Canvas Tricks
Stupid Canvas Tricks
 
HTML5 Games with CreateJS
HTML5 Games with CreateJSHTML5 Games with CreateJS
HTML5 Games with CreateJS
 
Intro to programming games with clojure
Intro to programming games with clojureIntro to programming games with clojure
Intro to programming games with clojure
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
WP7 HUB_XNA
WP7 HUB_XNAWP7 HUB_XNA
WP7 HUB_XNA
 
MIDP: Game API
MIDP: Game APIMIDP: Game API
MIDP: Game API
 
Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2
 
Unity3 d devfest-2014
Unity3 d devfest-2014Unity3 d devfest-2014
Unity3 d devfest-2014
 
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
Анатолій Ландишев - “Незв’язний код у Unity” GameCC 2017
 
Dart - en ny platform til webudvikling af Rico Wind, Google
Dart - en ny platform til webudvikling af Rico Wind, GoogleDart - en ny platform til webudvikling af Rico Wind, Google
Dart - en ny platform til webudvikling af Rico Wind, Google
 

Recently uploaded

Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 

Recently uploaded (20)

Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 

Game age ppt

  • 4.
  • 6.
  • 7.
  • 10.
  • 11.
  • 12.
  • 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(); } };