Sunday, 11 June 2017
PAIR MATCHING GAME
--------------------------------------------------------------------------------------------------------------
https://codepen.io/natewiley/pen/HBrbL
https://codepen.io/jdnichollsc/full/WbZgwM/
EMIR97 MEMORY GAME GITHUB
https://sites.google.com/site/javafilesblogger/memory-game
https://github.com/emir97?tab=repositories
https://www.youtube.com/watch?v=zZ_YxLuRNe4
----------------------------------------------------------------------------------------------------------------
PATTERN MATCHING GAME
https://www.google.co.uk/search?q=matching+pattern+game&rlz=1C1_____enGB747GB747&oq=matching+pattern+game&aqs=chrome..69i57j0l5.25821j0j4&sourceid=chrome&ie=UTF-8
Boolean matching game javascript
http://ionicabizau.github.io/match.js/example/
FIND WORD IN GOOGLE: matching pattern game
http://www.1001games.net/game/matching-pattern.html
http://www.funnygames.in/game/matching_patterns.html
ANIMAL CONNECTION GAME
http://www.mahjonggames.name/view/Animals-Connect.html
MATCHING CONNECT GAME IN HTML
http://www.manythings.org/lulu/d1.html
http://jeux.lulu.pagesperso-orange.fr/english.htm
http://jeux.lulu.pagesperso-orange.fr/
http://jeux.lulu.pagesperso-orange.fr/html/memoire/mCouleur/de2Cou2.htm
http://www.manythings.org/lulu/d3.html#
http://jeux.lulu.pagesperso-orange.fr/html/memoire/mFruits/assFru.htm
OTHER MULTI HTML QUIZ WITH 4 OPTIONS A,B,C,D
http://www.similarsitesearch.com/alternatives-to/manythings.org
http://iteslj.org/v/ei/nouns1.html
https://www.google.co.uk/search?q=English+Vocabulary+Quizzes+Using+Images
http://mmemichelebell.weebly.com/useful-links-and-websites.html
"Puzzle Generator"
http://jeux.lulu.pagesperso-orange.fr/html/dipuzzle/puzFaire/puzgene.htm
http://jeux.lulu.pagesperso-orange.fr/html/question/question.htm
https://www.google.co.uk/search?q=Image+to+Word+Matching
https://www.pinterest.co.uk/pin/212372938648177172/
https://www.quia.com/createYourOwnActivities.html
https://www.quia.com/cm/25645.html
http://www.quiz-builder.com/thankyou.html
http://www.dhtmlgoodies.com/index.html?whichScript=quiz-maker
without face down matching game javascript
https://www.google.co.uk/search?rlz=1C1_____enGB747GB747&biw=1164&bih=586&q=without+face+down+matching+game+javascript&oq=without+face+down+matching+game+jav&gs_l=psy-ab.1.0.33i21k1l2.4197.6151.0.8306.4.4.0.0.0.0.156.382.3j1.4.0....0...1.1.64.psy-ab..0.4.380...33i160k1.R2JU3VE_Xek
https://www.google.co.uk/search?rlz=1C1CHBD_en-GBGB813GB813&biw=1280&bih=640&tbm=isch&sa=1&ei=kj4QXL-kFPOf1fAPvN-DGA&q=simple+picture+matching+game+javascript+without+flip&oq=simple+picture+matching+game+javascript+without+flip&gs_l=img.3...247.4148..4485...1.0..0.549.1385.3j0j1j1j0j1......1....1..gws-wiz-img.V-xrIUIQhXU
https://github.com/topics/matching-game
https://github.com/Calexxxxx/memory
Download
Files in package:
- js/dg-quiz-maker.js - Main javascript file for the widget
- js/external/* - Mootools library used by the script
GamesThe generators |
http://jeux.lulu.pagesperso-orange.fr/html/memoire/mCouleur/de2Cou2.htm
http://jeux.lulu.pagesperso-orange.fr/html/anglais/assoMemo/2par2Som.htm
https://games.cdn.famobi.com/html5games/o/onet-connect-classic/v160/?fg_domain=play.famobi.com&fg_aid=A1000-1&fg_uid=d6173a60-1b41-4b34-b4c3-aa4c5fc9ce35&fg_pid=4638e320-4444-4514-81c4-d80a8c662371&fg_beat=565#_ga=2.208796370.1713468681.1497702839-1793333768.1497702839
FIND IN GOOGLE:
vocabulary and pictures games
vocabulary and pictures games html
https://www.google.co.uk/search?q=vocabulary+and+pictures+games+html
http://www.esolhelp.com/vocabulary-games.html
OR connect words to image Game in javascript
http://www.manythings.org/lulu/d1.html
http://jeux.lulu.pagesperso-orange.fr/html/rimes/rime2.htm
http://www.javascriptsource.com/games/
https://learnenglish.britishcouncil.org/en/vocabulary-games
VOCABULARY AND PICTURE MATCHING GAME
http://englishteststore.net/index.php?option=com_content&view=article&id=12309&Itemid=378
Copyright 2013 www.englishteststore.com Text Loading... Please wait ...
englishteststore.net/englishgames/match_game/picture_match_fruits.swf
http://eslgamesworld.com/members/games/vocabulary/labeling/food/index.html
https://www.ezschool.com/play/english/click-the-word-that-matches-the-picture/362
https://www.turtlediary.com/game/fruit-matching-game.html
http://www.esolcourses.com/vocabulary/beginners.html
http://www.esolcourses.com/uk-english/beginners-course/unit-2/classroom-objects/classroom-objects-picture-quiz.html
http://www.onlinemathlearning.com/color-game.html
https://www.varsitytutors.com/aplusmath/matho/addition
Match-Three Game Blueprint
https://github.com/gamelab/Match-Three-Blueprint
simple tile match in java script
https://www.google.co.uk/search?q=siple+tile+match+in+java+script&rlz=1C1_____enGB747GB747&oq=siple+tile+match+in+java+script&aqs=chrome..69i57.11357j0j4&sourceid=chrome&ie=UTF-8
----------------------------------------------------------------------------------------------------------------
MATCHING PAIR GAME
http://www.primarygames.com/puzzles/match_up/findthepair/
WORD ON SCREEN AND TYPE AND GET SCORE
https://www.sporcle.com/games/citkeane/reverse-concentration
https://codepen.io/mel/pen/Brads
https://s.codepen.io/boomerang/iFrameKey-af747a17-4c83-adc6-106c-5bf876f62464/index.html
QUIZ BUILDER DOWNLOAD
Communicator 5.3 SOFTWARE
https://www.youtube.com/watch?v=vJssrpoaPhM&t=14s
https://www.tobiidynavox.com/products/software/
http://www.quiz-builder.com/thankyou.html
------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html class=''>
<!-- https://codepen.io/natewiley/pen/HBrbL -->
<head>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css'>
<link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Anton'>
<style class="cp-pen-styles">
@import url(http://weloveiconfonts.com/api/?family=brandico);
/* brandico */
[class*="brandico-"]:before {
font-family: 'brandico', sans-serif;
}
* {
box-sizing: border-box;
}
html, body {
height: 100%;
}
body {
background: black;
min-height: 100%;
font-family: "Arial", sans-serif;
}
.wrap {
position: relative;
height: 100%;
min-height: 500px;
padding-bottom: 20px;
}
.game {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-perspective: 500px;
perspective: 500px;
min-height: 100%;
height: 100%;
}
@-webkit-keyframes matchAnim {
0% {
background: #bcffcc;
}
100% {
background: white;
}
}
@keyframes matchAnim {
0% {
background: #bcffcc;
}
100% {
background: white;
}
}
.card {
float: left;
width: 16.66666%;
height: 25%;
padding: 5px;
text-align: center;
display: block;
-webkit-perspective: 500px;
perspective: 500px;
position: relative;
cursor: pointer;
z-index: 50;
-webkit-tap-highlight-color: transparent;
}
@media (max-width: 800px) {
.card {
width: 25%;
height: 16.666%;
}
}
.card .inside {
width: 100%;
height: 100%;
display: block;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transition: .4s ease-in-out;
transition: .4s ease-in-out;
background: white;
}
.card .inside.picked, .card .inside.matched {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.card .inside.matched {
-webkit-animation: 1s matchAnim ease-in-out;
animation: 1s matchAnim ease-in-out;
-webkit-animation-delay: .4s;
animation-delay: .4s;
}
.card .front, .card .back {
border: 1px solid black;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 20px;
}
.card .front img, .card .back img {
max-width: 100%;
display: block;
margin: 0 auto;
max-height: 100%;
}
.card .front {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
@media (max-width: 800px) {
.card .front {
padding: 5px;
}
}
@media (max-width: 800px) {
.card .back {
padding: 10px;
}
}
.modal-overlay {
display: none;
background: rgba(0, 0, 0, 0.8);
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.modal {
display: none;
position: relative;
width: 500px;
height: 400px;
max-height: 90%;
max-width: 90%;
min-height: 380px;
margin: 0 auto;
background: white;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
padding: 30px 10px;
}
.modal .winner {
font-size: 80px;
text-align: center;
font-family: "Anton", sans-serif;
color: #4d4d4d;
text-shadow: 0px 3px 0 black;
}
@media (max-width: 480px) {
.modal .winner {
font-size: 60px;
}
}
.modal .restart {
font-family: "Anton", sans-serif;
margin: 30px auto;
padding: 20px 30px;
display: block;
font-size: 30px;
border: none;
background: #4d4d4d;
background: -webkit-linear-gradient(#4d4d4d, #222);
background: linear-gradient(#4d4d4d, #222);
border: 1px solid #222;
border-radius: 5px;
color: white;
text-shadow: 0px 1px 0 black;
cursor: pointer;
}
.modal .restart:hover {
background: -webkit-linear-gradient(#222, black);
background: linear-gradient(#222, black);
}
.modal .message {
text-align: center;
}
.modal .message a {
text-decoration: none;
color: #28afe6;
font-weight: bold;
}
.modal .message a:hover {
color: #56c0eb;
border-bottom: 1px dotted #56c0eb;
}
.modal .share-text {
text-align: center;
margin: 10px auto;
}
.modal .social {
margin: 20px auto;
text-align: center;
}
.modal .social li {
display: inline-block;
height: 50px;
width: 50px;
margin-right: 10px;
}
.modal .social li:last-child {
margin-right: 0;
}
.modal .social li a {
display: block;
line-height: 50px;
font-size: 20px;
color: white;
text-decoration: none;
border-radius: 5px;
}
.modal .social li a.facebook {
background: #3b5998;
}
.modal .social li a.facebook:hover {
background: #4c70ba;
}
.modal .social li a.google {
background: #D34836;
}
.modal .social li a.google:hover {
background: #dc6e60;
}
.modal .social li a.twitter {
background: #4099FF;
}
.modal .social li a.twitter:hover {
background: #73b4ff;
}
footer {
height: 20px;
position: absolute;
bottom: 0;
width: 100%;
z-index: 0;
}
footer .disclaimer {
line-height: 20px;
font-size: 12px;
color: #727272;
text-align: center;
}
@media (max-width: 767px) {
footer .disclaimer {
font-size: 8px;
}
}
</style></head><body>
<div class="wrap">
<div class="game"></div>
<div class="modal-overlay">
<div class="modal">
<h2 class="winner">You Rock!</h2>
<button class="restart">Play Again?</button>
<p class="message">Developed on <a href="https://codepen.io">CodePen</a> by <a href="https://codepen.io/natewiley">Nate Wiley</a></p>
<p class="share-text">Share it?</p>
<ul class="social">
<li><a target="_blank" class="twitter" href="https://twitter.com/share?url=https://codepen.io/natewiley/pen/HBrbL"><span class="brandico-twitter-bird"></span></a></li>
<li><a target="_blank" class="facebook" href="https://www.facebook.com/sharer.php?u=https://codepen.io/natewiley/pen/HBrbL"><span class="brandico-facebook"></span></a></li>
<li><a target="_blank" class="google" href="https://plus.google.com/share?url=https://codepen.io/natewiley/pen/HBrbL"><span class="brandico-googleplus-rect"></span></a></li>
</ul>
</div>
</div>
<footer>
<p class="disclaimer">All logos are property of their respective owners, No Copyright infringement intended.</p>
</footer>
</div><!-- End Wrap -->
<!-- I ADD FILE LINK FROM CODE PEN -->
<script src='https://production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script>// Memory Game
// 2014 Nate Wiley
// License -- MIT
// best in full screen, works on phones/tablets (min height for game is 500px..) enjoy ;)
// Follow me on Codepen
(function(){
var Memory = {
init: function(cards){
this.$game = $(".game");
this.$modal = $(".modal");
this.$overlay = $(".modal-overlay");
this.$restartButton = $("button.restart");
this.cardsArray = $.merge(cards, cards);
this.shuffleCards(this.cardsArray);
this.setup();
},
shuffleCards: function(cardsArray){
this.$cards = $(this.shuffle(this.cardsArray));
},
setup: function(){
this.html = this.buildHTML();
this.$game.html(this.html);
this.$memoryCards = $(".card");
this.binding();
this.paused = false;
this.guess = null;
},
binding: function(){
this.$memoryCards.on("click", this.cardClicked);
this.$restartButton.on("click", $.proxy(this.reset, this));
},
// kinda messy but hey
cardClicked: function(){
var _ = Memory;
var $card = $(this);
if(!_.paused && !$card.find(".inside").hasClass("matched") && !$card.find(".inside").hasClass("picked")){
$card.find(".inside").addClass("picked");
if(!_.guess){
_.guess = $(this).attr("data-id");
} else if(_.guess == $(this).attr("data-id") && !$(this).hasClass("picked")){
$(".picked").addClass("matched");
_.guess = null;
} else {
_.guess = null;
_.paused = true;
setTimeout(function(){
$(".picked").removeClass("picked");
Memory.paused = false;
}, 600);
}
if($(".matched").length == $(".card").length){
_.win();
}
}
},
win: function(){
this.paused = true;
setTimeout(function(){
Memory.showModal();
Memory.$game.fadeOut();
}, 1000);
},
showModal: function(){
this.$overlay.show();
this.$modal.fadeIn("slow");
},
hideModal: function(){
this.$overlay.hide();
this.$modal.hide();
},
reset: function(){
this.hideModal();
this.shuffleCards(this.cardsArray);
this.setup();
this.$game.show("slow");
},
// Fisher--Yates Algorithm -- https://bost.ocks.org/mike/shuffle/
shuffle: function(array){
var counter = array.length, temp, index;
// While there are elements in the array
while (counter > 0) {if (window.CP.shouldStopExecution(1)){break;}
// Pick a random index
index = Math.floor(Math.random() * counter);
// Decrease counter by 1
counter--;
// And swap the last element with it
temp = array[counter];
array[counter] = array[index];
array[index] = temp;
}
window.CP.exitedLoop(1);
return array;
},
buildHTML: function(){
var frag = '';
this.$cards.each(function(k, v){
frag += '<div class="card" data-id="'+ v.id +'"><div class="inside">\
<div class="front"><img src="'+ v.img +'"\
alt="'+ v.name +'" /></div>\
<div class="back"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/codepen-logo.png"\
alt="Codepen" /></div></div>\
</div>';
});
return frag;
}
};
var cards = [
{
name: "php",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/php-logo_1.png",
id: 1,
},
{
name: "css3",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/css3-logo.png",
id: 2
},
{
name: "html5",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/html5-logo.png",
id: 3
},
{
name: "jquery",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/jquery-logo.png",
id: 4
},
{
name: "javascript",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/js-logo.png",
id: 5
},
{
name: "node",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/nodejs-logo.png",
id: 6
},
{
name: "photoshop",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/photoshop-logo.png",
id: 7
},
{
name: "python",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/python-logo.png",
id: 8
},
{
name: "rails",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/rails-logo.png",
id: 9
},
{
name: "sass",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/sass-logo.png",
id: 10
},
{
name: "sublime",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/sublime-logo.png",
id: 11
},
{
name: "wordpress",
img: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/74196/wordpress-logo.png",
id: 12
},
];
Memory.init(cards);
})();
</script>
</body>
</html>
----------------------------------------------------------------------------------------------------------------READ MORE:
http://memorygame.quizyplugin.com/
https://www.youtube.com/watch?v=vJssrpoaPhM
https://www.tobiidynavox.com/products/software/
---------------------------------------------------------------------------------------------------------------
<html>
<!-- http://memorygame.quizyplugin.com/ -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>jQuery memory card / concentration / pairs game</title>
<style>
/*
CSS for Memogry game plugin
Author: Yane Frenski
*/
/* the stle for the wrapper element */
.quizy-memorygame{
position:relative;
width:100%;
}
/* styles of the card to show */
.quizy-memorygame .mgcard-show{
width:156px;
height:156px;
background:url('http://memorygame.quizyplugin.com/css/img/mg-mcard.png');
}
.quizy-memorygame .quizy-mg-item{
position:absolute;
cursor:pointer;
text-align:center;
}
.quizy-memorygame .quizy-mg-item .quizy-mg-item-bottom, .quizy-memorygame .quizy-mg-item .quizy-mg-item-top{
position:absolute;
top:0;
left:0;
text-align:center;
}
.quizy-mg-item .quizy-mg-item-top{
background:url('http://memorygame.quizyplugin.com/css/img/quizy-mg-item-top.png');
}
/* styles for the popup notifications */
.quizy-mg-notification-fly{
width:90px;
height:90px;
position:absolute;
z-index:1000;
display:none;
-moz-box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
-webkit-box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
}
.quizy-mg-notification-fly-neg{
background:url('http://memorygame.quizyplugin.com/css/img/quizy-mg-notif-neg.png');
}
.quizy-mg-notification-fly-pos{
background:url('http://memorygame.quizyplugin.com/css/img/quizy-mg-notif-pos.png');
}
/* styles for the game summary */
#quizy-game-summary {
width:300px;
height:160px;
position:absolute;
z-index:1001;
background: #515b69;
box-shadow: rgba(0,0,0,0.7) 0 0 4px, inset 0 0 20px rgba(0, 0, 0, 0.4);;
border:1px solid #000;
display:none;
text-align: center;
}
#quizy-game-summary div.gs-column{
width:75px;
float:left;
padding:10px 0 10px 20px;
color:#fff;
text-shadow: 1px 1px 1px rgba(0,0,0, 0.5);
text-align:center;
}
#quizy-game-summary #gs-column1{
font-size:16px;
padding-top:30px;
}
#quizy-game-summary #gs-column2{
font-size:12px;
padding-top: 65px;
background:url('http://memorygame.quizyplugin.com/css/img/mg-timeicon.png') no-repeat 70% 25%;
}
#quizy-game-summary #gs-column3{
font-size:12px;
padding-top: 65px;
background:url('http://memorygame.quizyplugin.com/css/img/mg-clickicon.png') no-repeat 70% 25%;
}
#quizy-game-summary #gs-closebut,
#quizy-game-summary #gs-replaybut{
display: inline-block;
margin-top: 10px;
width: 70px;
padding: 10px;
text-align: center;
background: #D7EEF0;
cursor: pointer;
}
#quizy-game-summary #gs-closebut:hover,
#quizy-game-summary #gs-replaybut:hover{
background: #fff;
}
#quizy-game-summary #gs-replaybut{
margin-right: 20px;
}
.quizy-game-clear{
clear: both;
}
</style>
<script src="http://memorygame.quizyplugin.com/js/libs/modernizr-2.5.3.min.js"></script>
</head>
<body>
<h3> Memory Card Game QUIZY </h3>
<div id="tutorial-memorygame" class="quizy-memorygame">
<ul>
<li class="match1">
<img src="http://memorygame.quizyplugin.com/img/flag-Bulgaria.png">
</li>
<li class="match2">
<img src="http://memorygame.quizyplugin.com/img/flag-Cuba.png">
</li>
<li class="match3">
<img src="http://memorygame.quizyplugin.com/img/flag-Sweden.png">
</li>
<li class="match4">
<img src="http://memorygame.quizyplugin.com/img/flag-NewZealand.png">
</li>
<li class="match5">
<img src="http://memorygame.quizyplugin.com/img/flag-Uruguay.png">
</li>
<li class="match1">
<br><br><br><p class="text-style1">Bulgaria</p>
</li>
<li class="match2">
<br><br><br><p class="text-style1">Cuba</p>
</li>
<li class="match3">
<br><br><br><p class="text-style1">Sweden</p>
</li>
<li class="match4">
<br><br><br><p class="text-style1">New Zealand</p>
</li>
<li class="match5">
<br><br><br><p class="text-style1">Uruguay</p>
</li>
</ul>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://memorygame.quizyplugin.com/js/libs/jquery-ui-1.8.17.custom.min.js"></script>
<script src="http://memorygame.quizyplugin.com/js/libs/jquery.flip.min.js"></script>
<script src="http://memorygame.quizyplugin.com/js/libs/jquery.quizymemorygame.js"></script>
<script>
$('#tutorial-memorygame').quizyMemoryGame({itemWidth: 156, itemHeight: 156, itemsMargin:40, colCount:5, animType:'flip' , flipAnim:'tb', animSpeed:250, resultIcons:true });
</script>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------G20 Countries and Capitals
https://github.com/apress/esntl-guide-to-html5
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
CODE MATCHING GAME WORKS WITH ID SUB STRING------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Quiz (multiple videos)</title>
<style>
.thing {position:absolute;left: 0px; top: 0px; border: 2px; border-style: double; background-color: white; margin: 5px; padding: 5px; }
#vid {position:absolute; visibility:hidden; z-index: 0; }
</style>
<script type="text/javascript">
var facts = [
["China","Beijing",false],
["India","New Delhi",false],
["European Union","Brussels",false],
["United States","Washington, DC",false],
["Indonesia","Jakarta",false],
["Brazil","Brasilia",false],
["Russia","Moscow",false],
["Japan","Tokyo",false],
["Mexico","Mexico City",false],
["Germany","Berlin",false],
["Turkey","Ankara",false],
["France","Paris",false],
["United Kingdom","London",false],
["Italy","Rome",false],
["South Africa","Pretoria",false],
["South Korea","Seoul",false],
["Argentina","Buenos Aires",false],
["Canada","Ottawa",false],
["Saudi Arabia","Riyadh",false],
["Australia","Canberra",false]
];
var thingelem;
var nq = 4; //number of questions asked in a game
var elementinmotion;
var makingmove = false;
var inbetween = 300;
var col1 = 20;
var row1 = 200;
var rowsize = 50;
var slots = new Array(nq);
function init(){
setupgame();
}
function setupgame() {
var i;
var c;
var s;
var mx = col1;
var my = row1;
var d;
var uniqueid;
// mark all faces as not being used.
for (i=0;i<facts.length;i++) {
facts[i][2] = false;
}
for (i=0;i<nq;i++) {
slots[i] = -100;
}
for(i=0;i<nq;i++) {
do {c = Math.floor(Math.random()*facts.length);}
while (facts[c][2]==true)
facts[c][2]=true;
uniqueid = "c"+String(c);
d = document.createElement('country');
d.innerHTML = (
"<div class='thing' id='"+uniqueid+"'>placeholder</div>");
document.body.appendChild(d);
thingelem = document.getElementById(uniqueid);
thingelem.textContent=facts[c][0];
thingelem.style.top = String(my)+"px";
thingelem.style.left = String(mx)+"px";
thingelem.addEventListener('click',pickelement,false);
uniqueid = "p"+String(c);
d = document.createElement('cap');
d.innerHTML = (
"<div class='thing' id='"+uniqueid+"'>placeholder</div>");
document.body.appendChild(d);
thingelem = document.getElementById(uniqueid);
thingelem.textContent=facts[c][1];
// put this thing in random choice from empty slots
do {s = Math.floor(Math.random()*nq);}
while (slots[s]>=0)
slots[s]=c;
thingelem.style.top = String(row1+s*rowsize)+"px";
thingelem.style.left = String(col1+inbetween)+"px";
thingelem.addEventListener('click',pickelement,false);
my +=rowsize;
}
document.f.score.value = "0";
return false;
}
function pickelement(ev) {
var thisx;
var thisxn;
var sc;
if (makingmove) {
if (this==elementinmotion) {
elementinmotion.style.backgroundColor = "white";
makingmove = false;
return;
}
thisx= this.style.left;
thisx = thisx.substring(0,thisx.length-2); //remove the px
thisxn = Number(thisx) + 115;
elementinmotion.style.left = String(thisxn)+"px";
elementinmotion.style.top = this.style.top;
makingmove = false;
if (this.id.substring(1)==elementinmotion.id.substring(1)) {
elementinmotion.style.backgroundColor = "gold";
this.style.backgroundColor = "gold";
document.f.out.value = "RIGHT";
sc = 1+Number(document.f.score.value);
document.f.score.value = String(sc);
if (sc==nq) {
v = document.getElementById("vid");
v.style.visibility = "visible";
v.style.zIndex="10000";
v.play();
}
}
else {
document.f.out.value = "WRONG";
elementinmotion.style.backgroundColor = "white";
}
}
else {
makingmove = true;
elementinmotion = this;
elementinmotion.style.backgroundColor = "tan";
}
}
</script>
</head>
<body onLoad="init();">
<h1>G20 Countries and Capitals </h1><br/>
Click on country or capital and then click on corresponding capital or country.
<p>
Reload for new game.
<form name="f" >
Action: <input name="out" type="text" value="RIGHT OR WRONG"/>
Score: <input name="score" type="text" value="0"/>
</form>
</p>
</body>
</html>
HTML 5 MATCHING MEMORY GAME
https://www.youtube.com/watch?v=ayxE3qrOdbc
------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Memory game using
pictures</title>
<style>
form {
width:330px;
margin:20px;
background-color:pink;
padding:20px;
}
input {
text-align:right;
}
</style>
<script type="text/javascript">
var cwidth = 900;
var cheight = 400;
var ctx;
var firstpick = true;
var firstcard = -1;
var secondcard;
var backcolor = "rgb(128,0,128)";
var tablecolor = "rgb(255,255,255)";
var deck = [];
var firstsx = 30;
var firstsy = 50;
var margin = 30;
var cardwidth = 100;
var cardheight = 100;
var tid;
var matched;
var starttime;
var count = 0;
var pairs = [
["https://goo.gl/JZQHfc","https://goo.gl/5nQ2hX"],
[ "https://goo.gl/WGtziY","https://goo.gl/dtKNs6"],
["https://goo.gl/t7wp3G","https://goo.gl/ZLebCq"],
["https://goo.gl/cdX1Wb","https://goo.gl/tZse4L"],
["https://goo.gl/EjbJRz","https://goo.gl/itrH7N"]
]
//deck holds info on the cards: the location and
dimensions, the src for the picture
// and identifying info
//the info is set using the array of arrays in the
makedeck function
function Card(sx,sy,swidth,sheight, img,
info) {
this.sx = sx;
this.sy = sy;
this.swidth = swidth;
this.sheight = sheight;
this.info = info;
this.img = img;
this.draw = drawback;
}
//generate deck of cards 6 pairs of polygons
function makedeck() {
var i;
var acard;
var bcard;
var pica;
var picb;
var cx = firstsx;
var cy = firstsy;
for(i=0;i<pairs.length;i++) {
pica = new Image();
pica.src = pairs[i][0];
acard = new Card(cx,cy,cardwidth,cardheight,pica,i);
deck.push(acard);
picb = new Image();
picb.src = pairs[i][1];
bcard = new Card(cx,cy+cardheight+margin,cardwidth,cardheight,picb,i);
deck.push(bcard);
cx = cx+cardwidth+ margin;
acard.draw();
bcard.draw();
}
}
function shuffle() {
//coded to resemble how I shuffled cards when
playing concentration
//swaps the changing information: the imgand the
info indicating the matching
var i;
var k;
var holderinfo;
var holderimg;
var dl = deck.length
var nt;
for (nt=0;nt<3*dl;nt++) { //do the swap 3 times deck.length times
i = Math.floor(Math.random()*dl);
k = Math.floor(Math.random()*dl);
holderinfo = deck[i].info;
holderimg = deck[i].img;
deck[i].info = deck[k].info;
deck[i].img = deck[k].img;
deck[k].info = holderinfo;
deck[k].img = holderimg;
}
}
function drawback() {
ctx.fillStyle = backcolor;
ctx.fillRect(this.sx,this.sy,this.swidth,this.sheight);
}
function choose(ev) {
var out;
var mx;
var my;
var pick1;
var pick2;
if ( ev.layerX || ev.layerX == 0) { // Firefox
mx= ev.layerX;
my = ev.layerY;
} else if (ev.offsetX ||
ev.offsetX == 0) { // Opera
mx = ev.offsetX;
my = ev.offsetY;
}
var i;
for (i=0;i<deck.length;i++){
var card = deck[i];
if (card.sx >=0) //this is the way to avoid checking for clicking on this space
if ((mx>card.sx)&&(mx<card.sx+card.swidth)&&(my>card.sy)&&(my<card.sy+card.sheight))
{
//check that this isn't clicking on first card
if ((firstpick)||
(i!=firstcard)) {
break;}
}
}
if (i<deck.length)
{ //clicked on a card
if (firstpick)
{
firstcard = i;
firstpick = false;
ctx.drawImage(card.img,card.sx,card.sy,card.swidth,card.sheight);
}
else {
secondcard = i;
ctx.drawImage(card.img,card.sx,card.sy,card.swidth,card.sheight);
if (card.info==deck[firstcard].info)
{
matched = true;
count++;
ctx.fillStyle= tablecolor;
ctx.fillRect(10,340,900,100);
ctx.fillStyle=backcolor;
ctx.fillText("Number of
matches so far: "+String(count),10,360);
if (count>=
.5*deck.length) {
var now = new Date();
var nt = Number(now.getTime());
var seconds = Math.floor(.5+(nt-starttime)/1000);
ctx.fillStyle= tablecolor;
ctx.fillRect(0,0,900,400);
ctx.fillStyle=backcolor;
out = "You finished in
"+String(seconds)+
" secs.";
ctx.fillText(out,10,100);
ctx.fillText("Reload the page
to try again.",10,300);
return;
}
}
else {
matched = false;
}
firstpick = true;
tid = setTimeout(flipback,1000);
}
}
}
function flipback() {
var card;
if (!matched)
{
deck[firstcard].draw();
deck[secondcard].draw();
}
else {
ctx.fillStyle = tablecolor;
ctx.fillRect(deck[secondcard].sx,deck[secondcard].sy,deck[secondcard].swidth,deck[secondcard].sheight);
ctx.fillRect(deck[firstcard].sx,deck[firstcard].sy,deck[firstcard].swidth,deck[firstcard].sheight);
deck[secondcard].sx = -1;
deck[firstcard].sx = -1;
}
}
function init(){
ctx = document.getElementById('canvas').getContext('2d');
canvas1 = document.getElementById('canvas');
canvas1.addEventListener('click',choose,false);
makedeck();
shuffle();
ctx.font="bold 20pt
sans-serif";
ctx.fillText("Click on two
cards to make a match.",10,20);
ctx.fillText("Number of
matches so far: 0",10,360);
starttime = new Date();
starttime = Number(starttime.getTime());
}
</script>
</head>
<body onLoad="init();">
<canvas id="canvas" width="900" height="400">
Your browser doesn't support the HTML5
element canvas.
</canvas>
<br/>
</body>
</html>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment