Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts

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.

Wednesday, July 8, 2015

Quick Tip: Integrate iAd banners in your iOS App with two lines of code

The easiest way to add an iAD banner to your app


Today I'll show a very simple way to integrate an ad banner to your iOS app. Most tutorials (including mine) explain the complex version by implementing the ADBannerViewDelegate protocol. If you don't care about error handling, animations, positioning or the maximum number of allowed banner instances (10!): There is a much easier way which requires only two lines of code in SWIFT.

Saturday, June 13, 2015

Quick Tip: Implement fullscreen (interstitial) Ads for iOS in SWIFT

How to implement an Interstitial Ad combined with a counter

Today I'll show how to implement a often used pattern in free games: Usually you can play free games a certain time, till a fullscreen ad is shown. For example after each third game over an ad is shown. Implementing this behaviour for the iOS platform requires only few lines of code in SWIFT.

Wednesday, March 4, 2015

How to add Social Media Integration to your iOS App

Welcome to my new SWIFT tutorial. Today I'll show you how to implement social media integration for Facebook and Twitter. Additionally I'll explain Email integration and how to embed a direct  AppStore link to provide a convenient way for players to rate an app.

My latest game in the AppStore contains a sample:


The four buttons at the bottom of the screen trigger the social actions:



Monday, February 9, 2015

How to implement a space shooter with SpriteKit and SWIFT - Part 7: iAd integration

Adding iAd integration




Welcome to part 7 of my swift programming tutorial. In the previous parts we've created sprites, added movement, enemies with a follow behaviour, bullets & shooting, a HUD, collision detection, sound & particle effects and a global leaderboard using Game Center. Today I'll show how to integrate the Apple Advertising Framework iAD:
  • Enable iAd in iTunesConnect
  • Add a Banner Ad (at the bottom of the screen)
  • Add a Fullscreen Ad (after game over)

Wednesday, January 14, 2015

How to implement a space shooter with SpriteKit and SWIFT - Part 6: Game Center integration

Adding Game Center integration




Welcome to part 6 of my swift programming tutorial. In the previous parts we've created sprites, added movement, created enemies which follow our sprite, added bullets, a HUD, collision detection, sound and particle effects. Today I'll show how to integrate Game Center to add a global leaderboard.


The most complex part is doing configuration stuff in iTunes Connect. 3 from 4 steps of this tutorial are related to that. You need a paid Apple Developer Account to execute the next steps:

  • Upload our App to iTunes Connect  
  • Create a Leaderboard in iTunes Connect 
  • Create a Sandbox Test User in iTunes Connect
  • Coding 

Thursday, November 27, 2014

How to implement a space shooter with SpriteKit and SWIFT - Part 4: Collision Detection

Adding basic game logic and collision detection





Welcome to part 4 of my tutorial series. In the previous parts we've created a sprite, added movement, created enemies which follow our sprite, added bullets and a HUD. But, for a real game some essential parts are missing:

  • Collision detection between the bullets and our sprite
  • Basic game logic
    • Scoring
    • Pause
    • Life Lost & Game Over

I'll show how to implement this today. As a starting point you can download the code from tutorial part 3 here


Wednesday, November 19, 2014

How to implement a space shooter with SpriteKit and SWIFT - Part 3: Create a HUD

Adding a HUD with SpriteKit and SWIFT





Tutorial Overview:


  • Part 1: Initial project setup, sprite creation and movement using SKAction and SKConstraint
  • Part 2: Adding enemies, bullets and shooting with SKAction and SKConstraint
  • Part 3: Adding a HUD with SKLabelNode and SKSpriteNode
  • Part 4: Adding basic game logic and collision detection
  • Part 5: Adding particles and sound 
  • Part 6: GameCenter integration

Add the HUD:

I'll add a simple HUD which shows the score, the remaining lifes and a pause button. As a starting point you can download the code from tutorial part 2 here

First of all let's fix a bug in the sample code of my last post. Open GameViewController.swift and move the code from viewDidLoad to viewDidAppear. This is necessary because the orientation change to landscape might not be completed. In this case width and height are inverted, if we determine them in viewDidLoad:

Tuesday, October 21, 2014

Writing games is more fun than writing a blog post: New teaser video for my upcoming tutorial

Sorry, I love writing blog posts, but this time I have written a small game instead of completing my tutorial. Here's another short teaser video:




That's all for today. The complete code will be available at GitHub soon.

Cheers,
Stefan

Wednesday, October 8, 2014

Kick off for my new Tutorial: How to implement a space shooter with SpriteKit and SWIFT

I'm preparing a new tutorial: 

My goal is to implement a complete space shooter with SpriteKit and SWIFT.

Planned content is:

  • Part 1: Initial project setup, sprite creation and movement using SKAction and SKConstraint
  • Part 2: Adding enemies, bullets and shooting with SKAction and SKConstraint
  • Part 3: Adding a HUD with SKLabelNode and SKSpriteNode
  • Part 4: Adding basic game logic and collision detection
  • Part 5: Adding particles and sound 
  • Part 6: GameCenter integration

Here's a short teaser video:


The sample code will be available on GitHub



That's all for today.

Cheers,
Stefan

Monday, July 21, 2014

How to convert/integrate SWIFT with Objective C

Welcome to Part 12 of my blog series about game development.
Today I'll show how to combine SWIFT with Objective-C code. There is no need to migrate all of your existing code to SWIFT. You’ll not sell one App more, if this is the only improvement of your new version. Not to mention all the possible new bugs you might include during the migration. A better strategy could be developing new code in SWIFT and keep existing code in Objective-C.

Prerequisite is XCode 6.1!

I've moved my blog to a new address: http://developerplayground.net
An updated version of this article for XCode 6.3 and SWIFT 1.2 can be found in my main Blog here.


I’ll show two scenarios:
  • calling SWIFT from Objective-C
  • calling Objective-C from SWIFT


Tuesday, March 18, 2014

HowTo: Implement endless scrolling


Welcome to Part 4 of my blog series about game development.

Today I'm showing how to implement an endless scrolling which is typical for Jump & Run games. 




First of all you need a background with 3 sections like the one shown below:



Section 1 and 3 must be identical and have to fit on the whole screen.