[Gametize Tech] API Knowledge: Minigame - Memory Game
FeaturedData for front-end
-
Challenge ID -
long
-
Challenge title -
String
-
Challenge description -
String
-
Image (to render as background) -
String
-
Number of lives -
int
-
List of options:
JSON
Note: Each option represents one memory card pair. This array will be provided to the front-end as JSON instead of Java objects so that it can be processed by Javascript. This will always be a number between 5-10. The Javascript code will render each option twice in random locations on the board.-
Option ID -
long
-
Option image -
String
-
Front-end Rendering
Initial Render
Using the above JSON example, the player will have to match 5 pairs of cards. This will give us a puzzle board of 10 cards arranged randomly without the images showing.
The number of lives also renders as shown.
The cards are not interactable until the player clicks on “Start Now!”
Starting the Game
When the player clicks on “Start Now!”, all the cards will flip to the image side and display for 3 seconds. After 3 seconds is up, all the cards will flip back to the blank side.
This gives the player an opportunity to memorize the cards.
Card flipping animation
During every interaction when the card changes from the blank side to the image side, it must visually “flip” with in an animation. You may look for an animation library to help you achieve this - ideally in Javascript or jQuery.
Game Play
The player begins to select pairs of cards to determine if they match.
A match is only considered successful when two identical pairs of cards are selected. You may use the option id
s to determine if the cards match.
If the match is not successful, the card flips back to the blank side, and one life is deducted.
If the match is successful, the matched cards continue to display on the board.
End of Game
The game ends either when the player has matched all the cards successfully, or when the player has run out of lives.
At this point, an API call is made to indicate that the challenge has been completed for the player.
Input parameters: session_key
, challenge_id
and lives_remaining
.
Display Results
The player’s result will be displayed as follows (points
are retrieved from the API call above).
The player may no longer interact with the cards at this point.
Note:
The article's technical specifications and details are subject to potential changes based on our discretion. It is important to note that the information presented in the article might have become outdated or lost its relevance in the present context.
If you are interested to learn more about this, please drop an email to support@gametize.com with your queries regarding the article!
Please sign in to leave a comment.
Comments
0 comments