This repository contains an example iOS game that integrates the Skillz SDK. It is intended to supplement the documentation that walks users through the process of integrating an iOS game.
All credits to the design of this game belongs to:
- Danqing Liu
- Scott Matthewman
- Sihao Lu
Original code: https://github.com/danqing/2048
Use governed by the MIT License.
This project integrated the Skillz SDK version 21.0.19 Beta. Check the Downloads page for the latest version.
The project was built on Xcode 10.1. Also, make sure you have the appropriate developer certificate and provisioning profiles so that it can be run on an iOS device. The provisioning profiles need to set the bundle name to com.skillz.examples.2048
.
If you are experiencing trouble, please email [email protected] with a detailed description of the issue you are encountering.
The commits in this repository have been organized to make the SDK integration easier to follow.
The first commit makes some preparations before integrating the SDK. Specifically, the UI was altered in anticipation of launching the Skillz SDK, being able to abort a match (the "Restart" button was renamed to "Forfeit"), and removing soon to be dead code.
The second commit simply installs the Skillz SDK that was downloaded from the Skillz Developer Portal. This is done by dragging the Skillz.framework
file into your XCode project, and adding it to both your Linked Libraries
and Embedded Binaries
build phases. Refer to the full instructions for more information.
At this point, the game is not integrated with the SDK and still compiles and runs normally.
Finally, the Skillz SDK is integrated by following the instructions at this page.
Changes in this commit include:
- Implementing the
SkillzDelegate
protocol so that the game is notified when a match will begin. - Modifying
M2ViewController
to launch the Skillz UI after the game's main view has been loaded. - Reporting the user's current score while a match is in progress.
- Reporting the user's final score when the match ends.
- Aborting a match.
This commit ensures fairness during a match by calling [Skillz getRandomNumberWithMin: andMax:]
when setting a ball's initial direction and force. Refer to this page for more details.