I have released a new version of Stop the Pop on Google Play and on the App Store.
There are a number of new features in it. Here are a few features which I thought were interesting during the last couple of weeks of development.
Skip Level Button
I added a new Skip level button. The player can watch an ad to skip the current level. The button only appears if you have not skipped a level in the last 24 hours.
I took a simple approach to this by just checking a if the current time minus the last time a level was skipped, if this was greater or equal than 24 hours, enable the button. When the user presses the skip level button, an Ad is shown. When the ad completes, the current time is saved.
Here’s a snippet of code:
bool Has24HoursElapsedSinceLastLevelSkip() {
DateTime lastSkipTime = DateTime.Parse(Settings.lastSkipLevelTime);
DateTime currentTime = DateTime.Now;
TimeSpan ts = currentTime - lastSkipTime;
return ts.TotalHours >= 24;
}
There is a downside to this approach and it might not be suitable for every use case. It is vulnerable to people to changing the date on the phone and it would show up again. It isn’t something I’m too worried about, if someone likes the game that much to go to that much hassle, I say, knock yourselves out! Of course a suitable solution to this would be to query an NTP server but that seems like it would be too much overhead for what it is doing.
Rate Us Pop Up Box
I also used something similar to the above code to add a new “Like Us” and “Rate Us” pop up. If you click that you like the game, it prompts to rate the game.
Animated Coin Count
I also added the coin count to the main HUD.
I wanted to give it more juice than just a static counter so when the player collects a coin, it changes the scale of the counter.
In the update loop I check the scale of the text, if it is above a certain threshold, I then lerp the scale of the text down.
if (coinCountText.gameObject.transform.localScale.x > 1.1f) {
//don't want to run the lerp on every frame for performance reasons, so adding this if statement for performance protection
coinCountText.gameObject.transform.localScale = Vector3.Lerp (coinCountText.gameObject.transform.localScale, Vector3.one, Time.deltaTime * 5f); //animate the coin collected text
}
coinCountText.text = player.GetCollectedCoins().Count.ToString();
Whenever the player picks up a coin I set the scale of the text to the max.
coinCountText.gameObject.transform.localScale = Vector3.one * coinCountTextScaleMax;
So essentially the code is always trying to shrink the scale to some threshold and then we just set the scale to a max value whenever it is picked up. It might not be the most elegant solution but it works!
Here’s what the animation turned out like
http://gph.is/2q5cwPL
Try it out
If you would like to test out Stop the Pop, you can download it here.
Google Play
The App Store
https://itunes.apple.com/us/app/stop-the-pop/id1166315634?ls=1&mt=8
As always, any feedback is greatly appreciated!