SlideShare uma empresa Scribd logo
1 de 10
Jogo em Javascript com HTML5
Trabalho da Cadeira DAW/MOSS 2010/2011
João Alves <jpralves@gmail.com>
Jogo em Javascript com HTML5
 Daddy’s Nightmare é um jogo que foi
desenvolvido em Javascript e que faz uso das
novas funcionalidades do HTML5
nomeadamente o canvas, localstorage e audio.
Deverá funcionar em qualquer browser que
suporte HTML5.
12-Jul-2011 João Alves <jpralves@gmail.com> 3
O HTML5
 O HTML5 é a quinta versão da linguagem HTML. Esta
nova versão traz consigo importantes mudanças
quanto ao papel do HTML no mundo da WEB,
trazendo novas funcionalidades como semântica e
acessibilidade, com novos recursos antes só
possíveis por meio de outras tecnologias, e trazendo
uma importante convergência dentre todos os novos
browsers de internet, tornando-o mais universal.
12-Jul-2011 João Alves <jpralves@gmail.com> 4
O HTML5
 Para este projecto em particular foi necessário
recorrer aos seguintes objectos novos:
 Canvas – permite o desenho de gráficos em tempo
real;
 Localstorage – permite guardar dados de forma
persistente do lado do cliente;
 Audio – cria um standard para reproduzir audio.
12-Jul-2011 João Alves <jpralves@gmail.com> 5
O Jogo
 Para o jogo são criados 3 objectos canvas que representam os
três locais onde é preciso “renderizar” elementos:
 Menu inicial (titlectx):
 Imagem estática;
 Texto;
 Boneco a movimentar-se;
 Barra Lateral da pontuação (pontosctx):
 Texto;
 Imagens.
 Area de Jogo (bonecoctx):
 Imagens;
 Captura do rato.
12-Jul-2011 João Alves <jpralves@gmail.com> 6
O Jogo
 O objectivo do jogo é satisfazer as necessidades
alimentares dos bebés, usando para isso o leite materno
armazenado no frigorífico. Antes de se poder dar o leite ao
bebé ele tem que ser aquecido no micro-ondas.
 Os bebés vão tendo um grau de insatisfação que é
medido por barras que são apresentadas junto à imagem
do bebé.
 O jogador perde uma vida quando um dos bebés atinge o
ponto de saturação e deixa de aguentar a fome.
 O jogador pode movimentar-se usando o rato para fazer o
drag-and-drop do pai ou através das teclas direccionais.
12-Jul-2011 João Alves <jpralves@gmail.com> 7
Ciclo de funcionamento do jogo
 Iniciar()
 Preparação dos canvas;
 Ler o HighScore se existir;
 Preparar o audio;
 ExecutaIntro():
 Ciclo theIntro até tecla Enter ou rato
 ExecutaJogo():
 Esconde o canvas do titulo;
 Mostra o canvas do Jogo;
 InitJogo();
 Inicializa a pontuação, vidas, etc.
 CicloJogo() até perder as vidas ou carregar na tecla ESC (Abortar);
12-Jul-2011 João Alves <jpralves@gmail.com> 8
Jogando o Jogo
 Demo
 Link: http://jpralves.net/dn/
12-Jul-2011 João Alves <jpralves@gmail.com> 9
Links Úteis
 Dive Into HTML5 - http://diveintohtml5.org/
 dean.edwards.name/packer/ - http://dean.edwards.name/packer/
 JSLint - http://www.jslint.com/
 JSHint - http://jshint.com/
 THE HTML5 TEST - http://html5test.com/
 W3C - http://dev.w3.org/html5/spec/Overview.html
 Html5demos - http://html5demos.com/
12-Jul-2011 João Alves <jpralves@gmail.com> 10
Jogo em Javascript com HTML5
 Q&A
João Alves
E-mail: jpralves@gmail.com
Web: http://jpralves.net/

Mais conteúdo relacionado

Destaque

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

HTML5 Game Canvas

  • 1. Jogo em Javascript com HTML5 Trabalho da Cadeira DAW/MOSS 2010/2011 João Alves <jpralves@gmail.com>
  • 2. Jogo em Javascript com HTML5  Daddy’s Nightmare é um jogo que foi desenvolvido em Javascript e que faz uso das novas funcionalidades do HTML5 nomeadamente o canvas, localstorage e audio. Deverá funcionar em qualquer browser que suporte HTML5.
  • 3. 12-Jul-2011 João Alves <jpralves@gmail.com> 3 O HTML5  O HTML5 é a quinta versão da linguagem HTML. Esta nova versão traz consigo importantes mudanças quanto ao papel do HTML no mundo da WEB, trazendo novas funcionalidades como semântica e acessibilidade, com novos recursos antes só possíveis por meio de outras tecnologias, e trazendo uma importante convergência dentre todos os novos browsers de internet, tornando-o mais universal.
  • 4. 12-Jul-2011 João Alves <jpralves@gmail.com> 4 O HTML5  Para este projecto em particular foi necessário recorrer aos seguintes objectos novos:  Canvas – permite o desenho de gráficos em tempo real;  Localstorage – permite guardar dados de forma persistente do lado do cliente;  Audio – cria um standard para reproduzir audio.
  • 5. 12-Jul-2011 João Alves <jpralves@gmail.com> 5 O Jogo  Para o jogo são criados 3 objectos canvas que representam os três locais onde é preciso “renderizar” elementos:  Menu inicial (titlectx):  Imagem estática;  Texto;  Boneco a movimentar-se;  Barra Lateral da pontuação (pontosctx):  Texto;  Imagens.  Area de Jogo (bonecoctx):  Imagens;  Captura do rato.
  • 6. 12-Jul-2011 João Alves <jpralves@gmail.com> 6 O Jogo  O objectivo do jogo é satisfazer as necessidades alimentares dos bebés, usando para isso o leite materno armazenado no frigorífico. Antes de se poder dar o leite ao bebé ele tem que ser aquecido no micro-ondas.  Os bebés vão tendo um grau de insatisfação que é medido por barras que são apresentadas junto à imagem do bebé.  O jogador perde uma vida quando um dos bebés atinge o ponto de saturação e deixa de aguentar a fome.  O jogador pode movimentar-se usando o rato para fazer o drag-and-drop do pai ou através das teclas direccionais.
  • 7. 12-Jul-2011 João Alves <jpralves@gmail.com> 7 Ciclo de funcionamento do jogo  Iniciar()  Preparação dos canvas;  Ler o HighScore se existir;  Preparar o audio;  ExecutaIntro():  Ciclo theIntro até tecla Enter ou rato  ExecutaJogo():  Esconde o canvas do titulo;  Mostra o canvas do Jogo;  InitJogo();  Inicializa a pontuação, vidas, etc.  CicloJogo() até perder as vidas ou carregar na tecla ESC (Abortar);
  • 8. 12-Jul-2011 João Alves <jpralves@gmail.com> 8 Jogando o Jogo  Demo  Link: http://jpralves.net/dn/
  • 9. 12-Jul-2011 João Alves <jpralves@gmail.com> 9 Links Úteis  Dive Into HTML5 - http://diveintohtml5.org/  dean.edwards.name/packer/ - http://dean.edwards.name/packer/  JSLint - http://www.jslint.com/  JSHint - http://jshint.com/  THE HTML5 TEST - http://html5test.com/  W3C - http://dev.w3.org/html5/spec/Overview.html  Html5demos - http://html5demos.com/
  • 10. 12-Jul-2011 João Alves <jpralves@gmail.com> 10 Jogo em Javascript com HTML5  Q&A João Alves E-mail: jpralves@gmail.com Web: http://jpralves.net/