Saturday, April 9, 2016

Apple Watch as Gaming Platform - Use the Digital Crown to control sprite movement for a Pong like game

Use the Digital Crown to control sprite movement

Welcome to my new WatchKit tutorial. Today I'll show that it is possible to use the Apple Watch as a gaming platform. First let's look back to the first WatchKit versions. They have been very limited in terms of possible input controls. A typical game was usually built with a number of WkInterfaceButtons and looked like this:



15 Puzzle AppleWatch15 Puzzle AppleWatch




Since WatchKit 2 it is possible to use the Digital Crown for custom apps. This provides way more possibilities for great games, like this Watch Ping Pong version created by me.
I'll publish the Source Code as OpenSource in my GitHub repository, once I have reached 1000 downloads. Currently only 986 to go ;-)


Pong AppleWatch


Friday, November 20, 2015

Quick Tip: Endless scrolling with SpriteKit and SWIFT (Part 2 of 2)

Natural endless scrolling with easing

Welcome to my tutorial series about scrolling:
  • Part 1: Endless scrolling with background tiles
  • Part 2: Natural endless scrolling with easing


In part one I showed how to implement endless scrolling. This is working fine, but there is still room for improvements. The scrolling starts immediately with full speed and also stops directly after the touch ends. A more natural movement would be to increase and decrease the speed slowly, till the target speed is reached or the movement is stopped. These is also known as ease in or ease out animation.
Thank you to hamobi who helped me with my Stackoverflow question for finding the right solution.

To give you an impression compare the two videos:

Without Easing:




With Easing:





Thursday, November 12, 2015

Quick Tip: Endless scrolling with SpriteKit and SWIFT (Part 1 of 2)

Endless scrolling with background tiles

Welcome to my new tutorial series about scrolling:
  • Part 1: Endless scrolling with background tiles
  • Part 2: Natural endless scrolling with easing

This video gives an impression what I'll show today:




1. About the algorithm and the background tiles


Creating the image tiles for the scrolling parts of the background:


First we need a background image:


Let's mirror this image and add the new one at the right side:


Thursday, October 1, 2015

Quick Tip: How to use the Apple TV remote to control a sprite in your TVOS Apps

How to use the Apple TV remote to control a sprite in your TVOS Apps

Since my Apple TV Developer kit arrived one week ago I had plenty of time to try certain things. I will blog about some of my prototypes in the next days.





Today I'll will focus again on the remote control. It provides, especially in combination with SpriteKit, a simple and very natural way to control a sprite on the screen. For a natural sprite movement the approach of my todays post is much better, the my article about gesture recognition on the AppleTV. 

Let's start...

1. Download the XCode 7.1 Beta from the Apple Developer Portal:




2. Create a new project:





Thursday, September 10, 2015

Quick Tip: How to use the remote control in your TVOS Apps for Apple TV in SWIFT

How to use the remote control in your tvOS Apps for Apple TV in SWIFT

There are already dozens of 'Hello world' tutorials published for the new Apple tvOS, so let's do something different. I'll show how to use the remote control to move a sprite on Apple TV. It was surprisingly easy and took me only 10 minutes to implement:

1. Download the XCode 7.1 Beta from the Apple Developer Portal:




2. Create a new project:




Saturday, August 29, 2015

Quick Tip: Implement the new Google AdMob / Adsense Cookie Policy

In the last days Google sent out emails to App developers which uses their AdSense and AdMob frameworks. Google urges them to inform their users about the usage of the advertising cookies:

From Google:
European laws require that digital publishers give visitors to their sites and apps information about their use of cookies and other forms of local storage. In many cases these laws also require that consent be obtained.

In this tutorial I'll  show how you can implement an information alert about the cookie usage in SWIFT. The basic idea is to detect, if the app is started the first time:
  • If yes show an alert with a message about the cookie usage. 
  • After clicking 'OK' store a key in NSUserDefault. 
  • Next time the application is started, this key will be found and therefore no alert will be shown.

IMPORTANT: I'm not a lawyer. So no guarantees. You have to decide on your own if this is sufficient.

AdMob Cookie Usage

Friday, July 10, 2015

Quick Tip: Combine iAd and AdMob Ads for iOS in SWIFT

Use iAd and AdMob ads in the same app

Today I'll show how to use iAd together with AdMob ads. If you use the interstitial ads provided by Apples iAd frequently, you might have seen that the fill rate is not always 100 percent:



One reason could be that there was just not enough time to load the new content. This tutorial shows how to improve the fill rate by requesting a Google AdMob ad in parallel. Depending on the availability, the iAd or the AdMob ad will be shown.