AstroBlitz: An Objective-C Odyssey

Beginnings

In 2013, with more enthusiasm than experience, I began writing an asteroid shooter in Objective-C. I had no clear direction - only a vague idea involving lasers, explosions, and epic music.

Spaceship

Animation eluded me, SpriteKit felt arcane, and “game design” was an abstract term. I cobbled together sprites, declared victory over the compiler, and called it a prototype.

SKTexture *playerTexture = [SKTexture textureWithImageNamed:@"player.png"];
self.player = [SKSpriteNode spriteNodeWithImageNamed:@"player.png"];
self.player.position = CGPointMake(self.player.size.width + 25, self.frame.size.height/2);

// Use texture to create outline of physica body that follows the contour of the sprite
// This lands more elegand collision effects, rathen than making a circle within which
// collisions happen
self.player.physicsBody = [SKPhysicsBody
                                   bodyWithTexture: playerTexture
                                   size: self.player.size];

// Setup physics collision masks to trigger logic on player's collision with an asteroid
self.player.physicsBody.categoryBitMask = playerCategory;
self.player.physicsBody.contactTestBitMask = obstacleCategory; 
self.player.physicsBody.collisionBitMask = 0;
self.player.physicsBody.dynamic = YES;
// Idling animation for the player
[self.player runAction:playerIdling];

It ran, technically. The ship floated, asteroids spawned in chaotic bursts, and everything exploded in an oddly satisfying but entirely unbalanced way. Then I left it to gather digital dust.

Incremental Chaos

Over the years I’d reopen the project - sometimes just to tweak a texture, other times to replace the background or sound. There was never a roadmap; only spontaneous bursts of motivation.
The visuals improved, the music evolved, and the mechanics became less absurd. The game, much like a bonsai tree, grew only when I felt patient enough to trim it.

SKAction *explosion = [SKAction animateWithTextures:self.explosionTextures timePerFrame:0.07];
[player runAction:explosion completion:^{
    [self showGameOver];
}];

The SpriteKit Breakthrough

Only recently did I truly “get” SpriteKit - how to handle collisions properly, manage transitions, and layer UI elements without them vanishing into the void of Z positioning. That realisation brought AstroBlitz back to life.

// The joy of using bit masks!
- (void)didBeginContact:(SKPhysicsContact *)contact {
    if ((contact.bodyA.categoryBitMask & playerCategory) &&
        (contact.bodyB.categoryBitMask & obstacleCategory)) {
        [self asteroid:(SKSpriteNode *)contact.bodyB.node didCollideWithPlayer:(SKSpriteNode *)contact.bodyA.node];
    }
}

Why Keep It in Objective-C?

Because it’s a delightful puzzle box. My daily work revolves around Swift and SwiftUI - modern, declarative, and elegant. Returning to Objective-C feels like visiting an eccentric old professor who still insists on using chalk. It’s clunky, verbose, but full of charm.
Every line reminds me how far iOS development has come, and yet, how capable this “legacy” language still is. And excercise for my brain too.

Music Meets Gameplay

The latest iteration adds something new for me - music-driven gameplay. The soundtrack isn’t just ambient filler; it dictates the rhythm of survival. A rising crescendo might herald a swarm of asteroids or a sudden boss encounter.
It’s cinematic chaos, with sound as the puppet master.

Creating a good pre- and after game experience can be tricky. I’ve decided to rely on assets that came with one of the themed packs from Themeforests. I did not feel confident enough in my artistic abilities to create anything myself at that time.

Menu

However, soon enough I’ve learnt that generic assets are not that great either. The solution? Custom fonts and colours!

The Monetisation Dilemma

Ads? I’d rather not. Nothing ruins immersion faster than a banner offering cheaper car insurance after a space battle.
So perhaps the answer lies in tasteful customisation - new ship skins, upgraded weapons, glowing shields. The sort of indulgences that make you feel powerful, not pestered.

AstroBlitz isn’t a polished studio title. It’s a long, meandering hobby - equal parts nostalgia, experimentation, and stubbornness.
And honestly, I wouldn’t have it any other way.

Tools & Technologies (so far)

  • Language: Objective-C (proudly archaic)
  • Framework: SpriteKit
  • Audio: AudioJungle, Quicktime
  • Assets: Themeforest, Envato
  • Editor: Xcode, occasionally terminal for old-school flair

TestFlight

No TestFlight yet - I’m still teaching the asteroids some manners, watch this space!


TAGS

iOS

SHARE VIA

RELATED POSTS