Archive

Archive for November, 2013

Snakes and Ladders, or really just ladders for now

November 5th, 2013 No comments

Spent some time working on ladders! They’re procedurally generated from a seed the same as the level is (and obviously need some tweaking). I’m still working on some of the physics of them. SpriteKit is really nice about setting the category, collision and contact bit masks (which call a delegate method), so it was easy to determine when a player was contacting a ladder.

self.physicsBody.categoryBitMask = featuresCategory;
self.physicsBody.collisionBitMask = 0;
self.physicsBody.contactTestBitMask = playerCategory;

I was hoping to simply set the player’s physics body’s affectedByGravity property to NO, but there’s some weirdness where it seems pre-existing velocity doesn’t go away (so the player will float up/down when the user isn’t pressing any keys). I’ll work on that soon to sort it out, but it’s a bit more fun to explore the caves now! Video below:

Ladders Video

Categories: Code, Game Development, Project Update Tags: