User prompt
Every time the player guesses correctly add 1 point to the score
User prompt
Game will not be over if player does not guess correctly
User prompt
Game will be over after the player goes over all the deck of cards
User prompt
Show score in the top centee of the screen
User prompt
Add a score counter that will add 1 every time higher or lower is guessed
User prompt
Move card 500 pixels up
User prompt
Move value in the top center and auit in the bottom centwr of the card
User prompt
Move card 500 pixels down
User prompt
Put the value on top of the asset and suit on the bottom
User prompt
Display on screen the value and suit of the card
User prompt
On game start player ill be displayed one card. He will then guess the next cards value is higher or lower by swiping up or down
User prompt
Show value and suit of the card in the card asset
User prompt
On game start card will have a random value and suit from the 52 available
User prompt
Fix Bug: 'Uncaught TypeError: card.setSuit is not a function' in this line: 'card.setSuit(suits[s]);' Line Number: 28
User prompt
At game start, will show ome of the random 52 cards of the deck.
Initial prompt
higher or lower
var Card = Container.expand(function () { var self = Container.call(this); var cardGraphics = self.createAsset('card', 'Card Graphics', .5, .5); var valueText = new Text2('', { size: 100, fill: '#ffffff', anchor: { x: 0.5, y: 0 } }); self.addChild(valueText); var suitText = new Text2('', { size: 100, fill: '#ffffff', anchor: { x: 0.5, y: 1 } }); self.addChild(suitText); self.setValue = function (value) { self.value = value; valueText.setText(value.toString()); }; self.setSuit = function (suit) { self.suit = suit; suitText.setText(suit); }; self.value = 0; self.setValue = function (value) { self.value = value; valueText.setText(value.toString()); }; self.setSuit = function (suit) { self.suit = suit; suitText.setText(suit); }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player Graphics', .5, .5); self.score = 0; self.updateScore = function (score) { self.score = score; }; }); var Game = Container.expand(function () { var self = Container.call(this); var deck = []; var player = self.addChild(new Player()); var currentCard = null; var nextCard = null; var suits = ['hearts', 'diamonds', 'clubs', 'spades']; for (var s = 0; s < suits.length; s++) { for (var i = 1; i <= 13; i++) { var card = new Card(); card.setValue(i); card.setSuit(suits[s]); deck.push(card); } } deck.sort(function () { return 0.5 - Math.random(); }); currentCard = deck[Math.floor(Math.random() * deck.length)]; var index = deck.indexOf(currentCard); deck.splice(index, 1); self.addChild(currentCard); currentCard.x = 2048 / 2; currentCard.y = 2732 / 2 - 200 + 500; player.x = 2048 / 2; player.y = 2732 / 2 + 200; var startY = null; stage.on('down', function (obj) { startY = obj.event.getLocalPosition(self).y; }); stage.on('up', function (obj) { var endY = obj.event.getLocalPosition(self).y; var guess = startY - endY > 0 ? 'lower' : 'higher'; nextCard = deck.pop(); self.addChild(nextCard); nextCard.x = 2048 / 2; nextCard.y = 2732 / 2 - 200 + 500; if (guess === 'higher' && nextCard.value > currentCard.value || guess === 'lower' && nextCard.value < currentCard.value) { player.updateScore(player.score + 1); } else { LK.showGameOver(); } currentCard.destroy(); currentCard = nextCard; nextCard = null; startY = null; }); });
===================================================================
--- original.js
+++ change.js
@@ -67,9 +67,9 @@
var index = deck.indexOf(currentCard);
deck.splice(index, 1);
self.addChild(currentCard);
currentCard.x = 2048 / 2;
- currentCard.y = 2732 / 2 - 200;
+ currentCard.y = 2732 / 2 - 200 + 500;
player.x = 2048 / 2;
player.y = 2732 / 2 + 200;
var startY = null;
stage.on('down', function (obj) {
@@ -80,9 +80,9 @@
var guess = startY - endY > 0 ? 'lower' : 'higher';
nextCard = deck.pop();
self.addChild(nextCard);
nextCard.x = 2048 / 2;
- nextCard.y = 2732 / 2 - 200;
+ nextCard.y = 2732 / 2 - 200 + 500;
if (guess === 'higher' && nextCard.value > currentCard.value || guess === 'lower' && nextCard.value < currentCard.value) {
player.updateScore(player.score + 1);
} else {
LK.showGameOver();
Green casino baize. To be used as background. No shade. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white rectangle flat. rounded corners. no background. no shadow. card shape.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.